
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Ebpf · 这是程序员吗</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="xishengcai">
        
        
    
    
    <link rel="stylesheet" href="../../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-toggle-chapters/toggle.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-disqus/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-prism/prism-base16-ateliersulphurpool.light.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-advanced-emoji/emoji-website.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-emphasize/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-katex/katex.min.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-sectionx/sectionx.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-local-video/video-js.min.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-terminal/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-versions-select/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    


    

        
    
    
    
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="readme.html" />
    
    
    <link rel="prev" href="cilium.html" />
    

    
    <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-chart/c3/c3.min.css">
    <script src="../../../gitbook/gitbook-plugin-chart/c3/d3.min.js"></script>
    <script src="../../../gitbook/gitbook-plugin-chart/c3/c3.min.js"></script>
    

    <script src="../../../gitbook/gitbook-plugin-graph/d3.min.js"></script>
    <script src="../../../gitbook/gitbook-plugin-graph/function-plot.js"></script>    

    
        <link rel="shortcut icon" href='../../../favicon.ico' type="image/x-icon">
    
    
        <link rel="bookmark" href='../../../favicon.ico' type="image/x-icon">
    
    
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"repo":"xishengcai/xisheng.blog","types":["star"],"size":"small"};
    </script>

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://xisheng.vip" target="_blank" class="custom-link">Home</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        <li class="header">Blog</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../../">
            
                <a href="../../../">
            
                    
                        <b>1.1.</b>
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../algorithm/">
            
                <a href="../../algorithm/">
            
                    
                        <b>1.2.</b>
                    
                    Algorithm
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../../algorithm/heap.html">
            
                <a href="../../algorithm/heap.html">
            
                    
                        <b>1.2.1.</b>
                    
                    Heap
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../../algorithm/readme.html">
            
                <a href="../../algorithm/readme.html">
            
                    
                        <b>1.2.2.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../../angular/">
            
                <a href="../../angular/">
            
                    
                        <b>1.3.</b>
                    
                    Angular
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../../angular/1-start.html">
            
                <a href="../../angular/1-start.html">
            
                    
                        <b>1.3.1.</b>
                    
                    Start
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../../angular/2-component.html">
            
                <a href="../../angular/2-component.html">
            
                    
                        <b>1.3.2.</b>
                    
                    Component
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../../angular/3-form.html">
            
                <a href="../../angular/3-form.html">
            
                    
                        <b>1.3.3.</b>
                    
                    Form
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../../angular/readme.html">
            
                <a href="../../angular/readme.html">
            
                    
                        <b>1.3.4.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../../database/">
            
                <a href="../../database/">
            
                    
                        <b>1.4.</b>
                    
                    Database
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../../database/mongodb.html">
            
                <a href="../../database/mongodb.html">
            
                    
                        <b>1.4.1.</b>
                    
                    Mongodb
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../../database/readme.html">
            
                <a href="../../database/readme.html">
            
                    
                        <b>1.4.2.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../../docker/">
            
                <a href="../../docker/">
            
                    
                        <b>1.5.</b>
                    
                    Docker
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../../docker/CentOS.html">
            
                <a href="../../docker/CentOS.html">
            
                    
                        <b>1.5.1.</b>
                    
                    CentOS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../../docker/install.html">
            
                <a href="../../docker/install.html">
            
                    
                        <b>1.5.2.</b>
                    
                    Install
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../../docker/readme.html">
            
                <a href="../../docker/readme.html">
            
                    
                        <b>1.5.3.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../../docker/官方shell.html">
            
                <a href="../../docker/官方shell.html">
            
                    
                        <b>1.5.4.</b>
                    
                    官方Shell
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../../golang/">
            
                <a href="../../golang/">
            
                    
                        <b>1.6.</b>
                    
                    Golang
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../../golang/aop.html">
            
                <a href="../../golang/aop.html">
            
                    
                        <b>1.6.1.</b>
                    
                    Aop
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../../golang/base/">
            
                <a href="../../golang/base/">
            
                    
                        <b>1.6.2.</b>
                    
                    Base
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.2.1" data-path="../../golang/base/copy.html">
            
                <a href="../../golang/base/copy.html">
            
                    
                        <b>1.6.2.1.</b>
                    
                    Copy
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.2" data-path="../../golang/base/new_and_make.html">
            
                <a href="../../golang/base/new_and_make.html">
            
                    
                        <b>1.6.2.2.</b>
                    
                    New And Make
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.3" data-path="../../golang/base/readme.html">
            
                <a href="../../golang/base/readme.html">
            
                    
                        <b>1.6.2.3.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.4" data-path="../../golang/base/reflect.html">
            
                <a href="../../golang/base/reflect.html">
            
                    
                        <b>1.6.2.4.</b>
                    
                    Reflect
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.5" data-path="../../golang/base/string.html">
            
                <a href="../../golang/base/string.html">
            
                    
                        <b>1.6.2.5.</b>
                    
                    String
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2.6" data-path="../../golang/base/tag.html">
            
                <a href="../../golang/base/tag.html">
            
                    
                        <b>1.6.2.6.</b>
                    
                    Tag
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../../golang/clouser.html">
            
                <a href="../../golang/clouser.html">
            
                    
                        <b>1.6.3.</b>
                    
                    Clouser
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../../golang/err 优雅处理.html">
            
                <a href="../../golang/err 优雅处理.html">
            
                    
                        <b>1.6.4.</b>
                    
                    Err 优雅处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../../golang/go module 2.html">
            
                <a href="../../golang/go module 2.html">
            
                    
                        <b>1.6.5.</b>
                    
                    Go Module 2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../../golang/go_mod.html">
            
                <a href="../../golang/go_mod.html">
            
                    
                        <b>1.6.6.</b>
                    
                    Go Mod
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../../golang/gocraftwork.html">
            
                <a href="../../golang/gocraftwork.html">
            
                    
                        <b>1.6.7.</b>
                    
                    Gocraftwork
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="../../golang/oauth.html">
            
                <a href="../../golang/oauth.html">
            
                    
                        <b>1.6.8.</b>
                    
                    Oauth
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="../../golang/readme.html">
            
                <a href="../../golang/readme.html">
            
                    
                        <b>1.6.9.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10" data-path="../../golang/swagger.html">
            
                <a href="../../golang/swagger.html">
            
                    
                        <b>1.6.10.</b>
                    
                    Swagger
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11" data-path="../../golang/tls.html">
            
                <a href="../../golang/tls.html">
            
                    
                        <b>1.6.11.</b>
                    
                    Tls
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.12" >
            
                <span>
            
                    
                        <b>1.6.12.</b>
                    
                    代码走读
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.12.1" data-path="../../golang/代码走读/2020.5.26.html">
            
                <a href="../../golang/代码走读/2020.5.26.html">
            
                    
                        <b>1.6.12.1.</b>
                    
                    2020.5.26
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.13" data-path="../../golang/任务队列/">
            
                <a href="../../golang/任务队列/">
            
                    
                        <b>1.6.13.</b>
                    
                    任务队列
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.13.1" data-path="../../golang/任务队列/gocraft-worker.html">
            
                <a href="../../golang/任务队列/gocraft-worker.html">
            
                    
                        <b>1.6.13.1.</b>
                    
                    Gocraft Worker
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.13.2" data-path="../../golang/任务队列/readme.html">
            
                <a href="../../golang/任务队列/readme.html">
            
                    
                        <b>1.6.13.2.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6.14" data-path="../../golang/参数校验.html">
            
                <a href="../../golang/参数校验.html">
            
                    
                        <b>1.6.14.</b>
                    
                    参数校验
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../../istio/">
            
                <a href="../../istio/">
            
                    
                        <b>1.7.</b>
                    
                    Istio
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../../istio/readme.html">
            
                <a href="../../istio/readme.html">
            
                    
                        <b>1.7.1.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../../istio/virtualservice.html">
            
                <a href="../../istio/virtualservice.html">
            
                    
                        <b>1.7.2.</b>
                    
                    Virtualservice
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" >
            
                <span>
            
                    
                        <b>1.8.</b>
                    
                    Java
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../../java/jvm.html">
            
                <a href="../../java/jvm.html">
            
                    
                        <b>1.8.1.</b>
                    
                    Jvm
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../../java/typescript.html">
            
                <a href="../../java/typescript.html">
            
                    
                        <b>1.8.2.</b>
                    
                    Typescript
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../">
            
                <a href="../">
            
                    
                        <b>1.9.</b>
                    
                    Kubernetes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../APIService.html">
            
                <a href="../APIService.html">
            
                    
                        <b>1.9.1.</b>
                    
                    APIService
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../CAK.html">
            
                <a href="../CAK.html">
            
                    
                        <b>1.9.2.</b>
                    
                    CAK
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../Deployment 的实现原理.html">
            
                <a href="../Deployment 的实现原理.html">
            
                    
                        <b>1.9.3.</b>
                    
                    Deployment 的实现原理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" data-path="../K8s源码/">
            
                <a href="../K8s源码/">
            
                    
                        <b>1.9.4.</b>
                    
                    K8s源码
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.4.1" data-path="../K8s源码/calico 源码分析.html">
            
                <a href="../K8s源码/calico 源码分析.html">
            
                    
                        <b>1.9.4.1.</b>
                    
                    Calico 源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4.2" data-path="../K8s源码/garbage collector controller 源码分析.html">
            
                <a href="../K8s源码/garbage collector controller 源码分析.html">
            
                    
                        <b>1.9.4.2.</b>
                    
                    Garbage Collector Controller 源码分析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4.3" data-path="../K8s源码/job.html">
            
                <a href="../K8s源码/job.html">
            
                    
                        <b>1.9.4.3.</b>
                    
                    Job
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4.4" data-path="../K8s源码/kube-proxy-iptables.html">
            
                <a href="../K8s源码/kube-proxy-iptables.html">
            
                    
                        <b>1.9.4.4.</b>
                    
                    Kube Proxy Iptables
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4.5" data-path="../K8s源码/kube-proxy-ipvs.html">
            
                <a href="../K8s源码/kube-proxy-ipvs.html">
            
                    
                        <b>1.9.4.5.</b>
                    
                    Kube Proxy Ipvs
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4.6" data-path="../K8s源码/kube-proxy.html">
            
                <a href="../K8s源码/kube-proxy.html">
            
                    
                        <b>1.9.4.6.</b>
                    
                    Kube Proxy
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4.7" data-path="../K8s源码/kubectl-exec.html">
            
                <a href="../K8s源码/kubectl-exec.html">
            
                    
                        <b>1.9.4.7.</b>
                    
                    Kubectl Exec
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4.8" data-path="../K8s源码/kubectl源码阅读1.html">
            
                <a href="../K8s源码/kubectl源码阅读1.html">
            
                    
                        <b>1.9.4.8.</b>
                    
                    Kubectl源码阅读1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4.9" data-path="../K8s源码/kubectl源码阅读2.html">
            
                <a href="../K8s源码/kubectl源码阅读2.html">
            
                    
                        <b>1.9.4.9.</b>
                    
                    Kubectl源码阅读2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4.10" data-path="../K8s源码/readme.html">
            
                <a href="../K8s源码/readme.html">
            
                    
                        <b>1.9.4.10.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4.11" data-path="../K8s源码/schedule.html">
            
                <a href="../K8s源码/schedule.html">
            
                    
                        <b>1.9.4.11.</b>
                    
                    Schedule
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4.12" data-path="../K8s源码/scheme.html">
            
                <a href="../K8s源码/scheme.html">
            
                    
                        <b>1.9.4.12.</b>
                    
                    Scheme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4.13" data-path="../K8s源码/调度队列.html">
            
                <a href="../K8s源码/调度队列.html">
            
                    
                        <b>1.9.4.13.</b>
                    
                    调度队列
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9.5" data-path="../Karmada.html">
            
                <a href="../Karmada.html">
            
                    
                        <b>1.9.5.</b>
                    
                    Karmada
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.6" data-path="../Pixie.html">
            
                <a href="../Pixie.html">
            
                    
                        <b>1.9.6.</b>
                    
                    Pixie
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.7" data-path="../admission access.html">
            
                <a href="../admission access.html">
            
                    
                        <b>1.9.7.</b>
                    
                    Admission Access
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.8" data-path="../ccm.html">
            
                <a href="../ccm.html">
            
                    
                        <b>1.9.8.</b>
                    
                    Ccm
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.9" data-path="../client-go.html">
            
                <a href="../client-go.html">
            
                    
                        <b>1.9.9.</b>
                    
                    Client Go
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.10" data-path="../command.html">
            
                <a href="../command.html">
            
                    
                        <b>1.9.10.</b>
                    
                    Command
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.11" data-path="../controller.html">
            
                <a href="../controller.html">
            
                    
                        <b>1.9.11.</b>
                    
                    Controller
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.12" data-path="../copy docker config.html">
            
                <a href="../copy docker config.html">
            
                    
                        <b>1.9.12.</b>
                    
                    Copy Docker Config
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.13" data-path="../etcd-operation.html">
            
                <a href="../etcd-operation.html">
            
                    
                        <b>1.9.13.</b>
                    
                    Etcd Operation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.14" data-path="../gc.html">
            
                <a href="../gc.html">
            
                    
                        <b>1.9.14.</b>
                    
                    Gc
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.15" data-path="../helm chart.html">
            
                <a href="../helm chart.html">
            
                    
                        <b>1.9.15.</b>
                    
                    Helm Chart
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.16" data-path="../helm.html">
            
                <a href="../helm.html">
            
                    
                        <b>1.9.16.</b>
                    
                    Helm
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.17" >
            
                <span>
            
                    
                        <b>1.9.17.</b>
                    
                    Helm
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.17.1" data-path="../helm/charts.html">
            
                <a href="../helm/charts.html">
            
                    
                        <b>1.9.17.1.</b>
                    
                    Charts
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.17.2" data-path="../helm/helm 钩子函数.html">
            
                <a href="../helm/helm 钩子函数.html">
            
                    
                        <b>1.9.17.2.</b>
                    
                    Helm 钩子函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.17.3" data-path="../helm/helm-operator.html">
            
                <a href="../helm/helm-operator.html">
            
                    
                        <b>1.9.17.3.</b>
                    
                    Helm Operator
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.17.4" data-path="../helm/文档查询.html">
            
                <a href="../helm/文档查询.html">
            
                    
                        <b>1.9.17.4.</b>
                    
                    文档查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.17.5" data-path="../helm/语法.html">
            
                <a href="../helm/语法.html">
            
                    
                        <b>1.9.17.5.</b>
                    
                    语法
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9.18" data-path="../install.html">
            
                <a href="../install.html">
            
                    
                        <b>1.9.18.</b>
                    
                    Install
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.19" data-path="../istio-inject.html">
            
                <a href="../istio-inject.html">
            
                    
                        <b>1.9.19.</b>
                    
                    Istio Inject
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.20" >
            
                <span>
            
                    
                        <b>1.9.20.</b>
                    
                    KubeEdge
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.21" data-path="../kuber-apiserver-flag.html">
            
                <a href="../kuber-apiserver-flag.html">
            
                    
                        <b>1.9.21.</b>
                    
                    Kuber Apiserver Flag
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.22" data-path="../kubernetes-client.html">
            
                <a href="../kubernetes-client.html">
            
                    
                        <b>1.9.22.</b>
                    
                    Kubernetes Client
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.23" data-path="../kubernetes灾备.html">
            
                <a href="../kubernetes灾备.html">
            
                    
                        <b>1.9.23.</b>
                    
                    Kubernetes灾备
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.24" data-path="../kubesphere/">
            
                <a href="../kubesphere/">
            
                    
                        <b>1.9.24.</b>
                    
                    Kubesphere
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.24.1" data-path="../kubesphere/helm.html">
            
                <a href="../kubesphere/helm.html">
            
                    
                        <b>1.9.24.1.</b>
                    
                    Helm
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.24.2" data-path="../kubesphere/readme.html">
            
                <a href="../kubesphere/readme.html">
            
                    
                        <b>1.9.24.2.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9.25" data-path="../kubevela/">
            
                <a href="../kubevela/">
            
                    
                        <b>1.9.25.</b>
                    
                    Kubevela
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.25.1" data-path="../kubevela/KubeVela 功能.html">
            
                <a href="../kubevela/KubeVela 功能.html">
            
                    
                        <b>1.9.25.1.</b>
                    
                    KubeVela 功能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.25.2" data-path="../kubevela/cue.html">
            
                <a href="../kubevela/cue.html">
            
                    
                        <b>1.9.25.2.</b>
                    
                    Cue
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.25.3" data-path="../kubevela/oam.html">
            
                <a href="../kubevela/oam.html">
            
                    
                        <b>1.9.25.3.</b>
                    
                    Oam
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.25.4" data-path="../kubevela/readme.html">
            
                <a href="../kubevela/readme.html">
            
                    
                        <b>1.9.25.4.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.25.5" data-path="../kubevela/rollout design.html">
            
                <a href="../kubevela/rollout design.html">
            
                    
                        <b>1.9.25.5.</b>
                    
                    Rollout Design
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.25.6" data-path="../kubevela/vela run.html">
            
                <a href="../kubevela/vela run.html">
            
                    
                        <b>1.9.25.6.</b>
                    
                    Vela Run
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.25.7" data-path="../kubevela/vela up.html">
            
                <a href="../kubevela/vela up.html">
            
                    
                        <b>1.9.25.7.</b>
                    
                    Vela Up
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.25.8" data-path="../kubevela/vela-cluster.html">
            
                <a href="../kubevela/vela-cluster.html">
            
                    
                        <b>1.9.25.8.</b>
                    
                    Vela Cluster
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.25.9" data-path="../kubevela/vela-helm.html">
            
                <a href="../kubevela/vela-helm.html">
            
                    
                        <b>1.9.25.9.</b>
                    
                    Vela Helm
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.25.10" data-path="../kubevela/vela-pk-oam.html">
            
                <a href="../kubevela/vela-pk-oam.html">
            
                    
                        <b>1.9.25.10.</b>
                    
                    Vela Pk Oam
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9.26" data-path="../mk-cert.html">
            
                <a href="../mk-cert.html">
            
                    
                        <b>1.9.26.</b>
                    
                    Mk Cert
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.27" data-path="../open_swagger-ui.html">
            
                <a href="../open_swagger-ui.html">
            
                    
                        <b>1.9.27.</b>
                    
                    Open Swagger Ui
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.28" data-path="../readme.html">
            
                <a href="../readme.html">
            
                    
                        <b>1.9.28.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.29" data-path="../task/">
            
                <a href="../task/">
            
                    
                        <b>1.9.29.</b>
                    
                    Task
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.29.1" data-path="../task/HPA.html">
            
                <a href="../task/HPA.html">
            
                    
                        <b>1.9.29.1.</b>
                    
                    HPA
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.29.2" data-path="../task/kubectl patch.html">
            
                <a href="../task/kubectl patch.html">
            
                    
                        <b>1.9.29.2.</b>
                    
                    Kubectl Patch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.29.3" data-path="../task/pod 信息注入.html">
            
                <a href="../task/pod 信息注入.html">
            
                    
                        <b>1.9.29.3.</b>
                    
                    Pod 信息注入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.29.4" data-path="../task/pod 垂直扩缩容.html">
            
                <a href="../task/pod 垂直扩缩容.html">
            
                    
                        <b>1.9.29.4.</b>
                    
                    Pod 垂直扩缩容
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.29.5" data-path="../task/readme.html">
            
                <a href="../task/readme.html">
            
                    
                        <b>1.9.29.5.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.29.6" data-path="../task/server-side-apply.html">
            
                <a href="../task/server-side-apply.html">
            
                    
                        <b>1.9.29.6.</b>
                    
                    Server Side Apply
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.29.7" data-path="../task/准入控制.html">
            
                <a href="../task/准入控制.html">
            
                    
                        <b>1.9.29.7.</b>
                    
                    准入控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.29.8" data-path="../task/聚合api.html">
            
                <a href="../task/聚合api.html">
            
                    
                        <b>1.9.29.8.</b>
                    
                    聚合Api
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.29.9" data-path="../task/资源预留配置.html">
            
                <a href="../task/资源预留配置.html">
            
                    
                        <b>1.9.29.9.</b>
                    
                    资源预留配置
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9.30" data-path="../webhook.html">
            
                <a href="../webhook.html">
            
                    
                        <b>1.9.30.</b>
                    
                    Webhook
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.31" data-path="../一致性认证.html">
            
                <a href="../一致性认证.html">
            
                    
                        <b>1.9.31.</b>
                    
                    一致性认证
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.32" data-path="../专利名词.html">
            
                <a href="../专利名词.html">
            
                    
                        <b>1.9.32.</b>
                    
                    专利名词
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.33" data-path="../删除namespace.html">
            
                <a href="../删除namespace.html">
            
                    
                        <b>1.9.33.</b>
                    
                    删除Namespace
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.34" data-path="../简化多集群.html">
            
                <a href="../简化多集群.html">
            
                    
                        <b>1.9.34.</b>
                    
                    简化多集群
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.35" data-path="./">
            
                <a href="./">
            
                    
                        <b>1.9.35.</b>
                    
                    网络插件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.35.1" data-path="calico.html">
            
                <a href="calico.html">
            
                    
                        <b>1.9.35.1.</b>
                    
                    Calico
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.35.2" data-path="cilium.html">
            
                <a href="cilium.html">
            
                    
                        <b>1.9.35.2.</b>
                    
                    Cilium
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.9.35.3" data-path="ebpf.html">
            
                <a href="ebpf.html">
            
                    
                        <b>1.9.35.3.</b>
                    
                    Ebpf
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.35.4" data-path="readme.html">
            
                <a href="readme.html">
            
                    
                        <b>1.9.35.4.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9.36" data-path="../镜像/">
            
                <a href="../镜像/">
            
                    
                        <b>1.9.36.</b>
                    
                    镜像
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.36.1" data-path="../镜像/Containerd Stargz Snapshotter.html">
            
                <a href="../镜像/Containerd Stargz Snapshotter.html">
            
                    
                        <b>1.9.36.1.</b>
                    
                    Containerd Stargz Snapshotter
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.36.2" data-path="../镜像/OCI.html">
            
                <a href="../镜像/OCI.html">
            
                    
                        <b>1.9.36.2.</b>
                    
                    OCI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.36.3" data-path="../镜像/harbor/">
            
                <a href="../镜像/harbor/">
            
                    
                        <b>1.9.36.3.</b>
                    
                    Harbor
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.36.3.1" data-path="../镜像/harbor/readme.html">
            
                <a href="../镜像/harbor/readme.html">
            
                    
                        <b>1.9.36.3.1.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9.36.4" data-path="../镜像/readme.html">
            
                <a href="../镜像/readme.html">
            
                    
                        <b>1.9.36.4.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.36.5" data-path="../镜像/自动构建镜像.html">
            
                <a href="../镜像/自动构建镜像.html">
            
                    
                        <b>1.9.36.5.</b>
                    
                    自动构建镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.36.6" data-path="../镜像/镜像加速方案.html">
            
                <a href="../镜像/镜像加速方案.html">
            
                    
                        <b>1.9.36.6.</b>
                    
                    镜像加速方案
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.36.7" data-path="../镜像/镜像延迟加载技术解析.html">
            
                <a href="../镜像/镜像延迟加载技术解析.html">
            
                    
                        <b>1.9.36.7.</b>
                    
                    镜像延迟加载技术解析
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../../math/">
            
                <a href="../../math/">
            
                    
                        <b>1.10.</b>
                    
                    Math
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../../math/readme.html">
            
                <a href="../../math/readme.html">
            
                    
                        <b>1.10.1.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../../math/泊松分布.html">
            
                <a href="../../math/泊松分布.html">
            
                    
                        <b>1.10.2.</b>
                    
                    泊松分布
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../../效率/">
            
                <a href="../../效率/">
            
                    
                        <b>1.11.</b>
                    
                    效率
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../../效率/cat.html">
            
                <a href="../../效率/cat.html">
            
                    
                        <b>1.11.1.</b>
                    
                    Cat
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../../效率/docker volume clean.html">
            
                <a href="../../效率/docker volume clean.html">
            
                    
                        <b>1.11.2.</b>
                    
                    Docker Volume Clean
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3" data-path="../../效率/git book.html">
            
                <a href="../../效率/git book.html">
            
                    
                        <b>1.11.3.</b>
                    
                    Git Book
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.4" data-path="../../效率/git.html">
            
                <a href="../../效率/git.html">
            
                    
                        <b>1.11.4.</b>
                    
                    Git
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.5" data-path="../../效率/linux command.html">
            
                <a href="../../效率/linux command.html">
            
                    
                        <b>1.11.5.</b>
                    
                    Linux Command
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.6" data-path="../../效率/linux 内核.html">
            
                <a href="../../效率/linux 内核.html">
            
                    
                        <b>1.11.6.</b>
                    
                    Linux 内核
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.7" data-path="../../效率/macos path.html">
            
                <a href="../../效率/macos path.html">
            
                    
                        <b>1.11.7.</b>
                    
                    Macos Path
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.8" data-path="../../效率/nfs.html">
            
                <a href="../../效率/nfs.html">
            
                    
                        <b>1.11.8.</b>
                    
                    Nfs
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.9" data-path="../../效率/nginx.html">
            
                <a href="../../效率/nginx.html">
            
                    
                        <b>1.11.9.</b>
                    
                    Nginx
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.10" data-path="../../效率/nginx2.html">
            
                <a href="../../效率/nginx2.html">
            
                    
                        <b>1.11.10.</b>
                    
                    Nginx2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.11" data-path="../../效率/oauth2.html">
            
                <a href="../../效率/oauth2.html">
            
                    
                        <b>1.11.11.</b>
                    
                    Oauth2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.12" data-path="../../效率/ovftool.html">
            
                <a href="../../效率/ovftool.html">
            
                    
                        <b>1.11.12.</b>
                    
                    Ovftool
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.13" data-path="../../效率/readme.html">
            
                <a href="../../效率/readme.html">
            
                    
                        <b>1.11.13.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.14" data-path="../../效率/sed.html">
            
                <a href="../../效率/sed.html">
            
                    
                        <b>1.11.14.</b>
                    
                    Sed
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.15" data-path="../../效率/shell_judge.html">
            
                <a href="../../效率/shell_judge.html">
            
                    
                        <b>1.11.15.</b>
                    
                    Shell Judge
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.16" data-path="../../效率/sshpass.html">
            
                <a href="../../效率/sshpass.html">
            
                    
                        <b>1.11.16.</b>
                    
                    Sshpass
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.17" data-path="../../效率/telepresence.html">
            
                <a href="../../效率/telepresence.html">
            
                    
                        <b>1.11.17.</b>
                    
                    Telepresence
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.18" data-path="../../效率/typora.html">
            
                <a href="../../效率/typora.html">
            
                    
                        <b>1.11.18.</b>
                    
                    Typora
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.19" data-path="../../效率/url encode.html">
            
                <a href="../../效率/url encode.html">
            
                    
                        <b>1.11.19.</b>
                    
                    Url Encode
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.20" data-path="../../效率/vim.html">
            
                <a href="../../效率/vim.html">
            
                    
                        <b>1.11.20.</b>
                    
                    Vim
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.21" data-path="../../效率/yum.html">
            
                <a href="../../效率/yum.html">
            
                    
                        <b>1.11.21.</b>
                    
                    Yum
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.22" data-path="../../效率/内网穿透.html">
            
                <a href="../../效率/内网穿透.html">
            
                    
                        <b>1.11.22.</b>
                    
                    内网穿透
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.23" data-path="../../效率/科学上网.html">
            
                <a href="../../效率/科学上网.html">
            
                    
                        <b>1.11.23.</b>
                    
                    科学上网
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.24" data-path="../../效率/证书制作.html">
            
                <a href="../../效率/证书制作.html">
            
                    
                        <b>1.11.24.</b>
                    
                    证书制作
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" >
            
                <span>
            
                    
                        <b>1.12.</b>
                    
                    杂谈
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../../杂谈/论好文章和烂文章.html">
            
                <a href="../../杂谈/论好文章和烂文章.html">
            
                    
                        <b>1.12.1.</b>
                    
                    论好文章和烂文章
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../../测试/">
            
                <a href="../../测试/">
            
                    
                        <b>1.13.</b>
                    
                    测试
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../../测试/ginkgo/">
            
                <a href="../../测试/ginkgo/">
            
                    
                        <b>1.13.1.</b>
                    
                    Ginkgo
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1.1" data-path="../../测试/ginkgo/ginkgo.html">
            
                <a href="../../测试/ginkgo/ginkgo.html">
            
                    
                        <b>1.13.1.1.</b>
                    
                    Ginkgo
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.1.2" data-path="../../测试/ginkgo/ginkgo_cmd.html">
            
                <a href="../../测试/ginkgo/ginkgo_cmd.html">
            
                    
                        <b>1.13.1.2.</b>
                    
                    Ginkgo Cmd
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.1.3" data-path="../../测试/ginkgo/readme.html">
            
                <a href="../../测试/ginkgo/readme.html">
            
                    
                        <b>1.13.1.3.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13.2" data-path="../../测试/golang-test.html">
            
                <a href="../../测试/golang-test.html">
            
                    
                        <b>1.13.2.</b>
                    
                    Golang Test
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.3" data-path="../../测试/http测试.html">
            
                <a href="../../测试/http测试.html">
            
                    
                        <b>1.13.3.</b>
                    
                    Http测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.4" data-path="../../测试/readme.html">
            
                <a href="../../测试/readme.html">
            
                    
                        <b>1.13.4.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.5" data-path="../../测试/其他功能.html">
            
                <a href="../../测试/其他功能.html">
            
                    
                        <b>1.13.5.</b>
                    
                    其他功能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.6" data-path="../../测试/单元测试.html">
            
                <a href="../../测试/单元测试.html">
            
                    
                        <b>1.13.6.</b>
                    
                    单元测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.7" data-path="../../测试/单元测试2.html">
            
                <a href="../../测试/单元测试2.html">
            
                    
                        <b>1.13.7.</b>
                    
                    单元测试2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.8" data-path="../../测试/基准测试.html">
            
                <a href="../../测试/基准测试.html">
            
                    
                        <b>1.13.8.</b>
                    
                    基准测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.9" data-path="../../测试/子测试与子基准测试.html">
            
                <a href="../../测试/子测试与子基准测试.html">
            
                    
                        <b>1.13.9.</b>
                    
                    子测试与子基准测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.10" data-path="../../测试/并行测试.html">
            
                <a href="../../测试/并行测试.html">
            
                    
                        <b>1.13.10.</b>
                    
                    并行测试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.11" data-path="../../测试/质量检查/">
            
                <a href="../../测试/质量检查/">
            
                    
                        <b>1.13.11.</b>
                    
                    质量检查
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.11.1" data-path="../../测试/质量检查/Sonar.html">
            
                <a href="../../测试/质量检查/Sonar.html">
            
                    
                        <b>1.13.11.1.</b>
                    
                    Sonar
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.11.2" data-path="../../测试/质量检查/go_lint.html">
            
                <a href="../../测试/质量检查/go_lint.html">
            
                    
                        <b>1.13.11.2.</b>
                    
                    Go Lint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.11.3" data-path="../../测试/质量检查/readme.html">
            
                <a href="../../测试/质量检查/readme.html">
            
                    
                        <b>1.13.11.3.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../../规范/">
            
                <a href="../../规范/">
            
                    
                        <b>1.14.</b>
                    
                    规范
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" data-path="../../规范/CodeReviewComments.html">
            
                <a href="../../规范/CodeReviewComments.html">
            
                    
                        <b>1.14.1.</b>
                    
                    CodeReviewComments
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.2" data-path="../../规范/git规范.html">
            
                <a href="../../规范/git规范.html">
            
                    
                        <b>1.14.2.</b>
                    
                    Git规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.3" data-path="../../规范/golang 代码规范.html">
            
                <a href="../../规范/golang 代码规范.html">
            
                    
                        <b>1.14.3.</b>
                    
                    Golang 代码规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.4" data-path="../../规范/readme.html">
            
                <a href="../../规范/readme.html">
            
                    
                        <b>1.14.4.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.5" data-path="../../规范/代码走读.html">
            
                <a href="../../规范/代码走读.html">
            
                    
                        <b>1.14.5.</b>
                    
                    代码走读
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../../设计模式/">
            
                <a href="../../设计模式/">
            
                    
                        <b>1.15.</b>
                    
                    设计模式
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.1" data-path="../../设计模式/readme.html">
            
                <a href="../../设计模式/readme.html">
            
                    
                        <b>1.15.1.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.2" data-path="../../设计模式/创建模型/">
            
                <a href="../../设计模式/创建模型/">
            
                    
                        <b>1.15.2.</b>
                    
                    创建模型
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.2.1" data-path="../../设计模式/创建模型/readme.html">
            
                <a href="../../设计模式/创建模型/readme.html">
            
                    
                        <b>1.15.2.1.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.2.2" data-path="../../设计模式/创建模型/创建者模型.html">
            
                <a href="../../设计模式/创建模型/创建者模型.html">
            
                    
                        <b>1.15.2.2.</b>
                    
                    创建者模型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.2.3" data-path="../../设计模式/创建模型/单例模式.html">
            
                <a href="../../设计模式/创建模型/单例模式.html">
            
                    
                        <b>1.15.2.3.</b>
                    
                    单例模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.2.4" data-path="../../设计模式/创建模型/原型模式.html">
            
                <a href="../../设计模式/创建模型/原型模式.html">
            
                    
                        <b>1.15.2.4.</b>
                    
                    原型模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.2.5" data-path="../../设计模式/创建模型/工厂方法.html">
            
                <a href="../../设计模式/创建模型/工厂方法.html">
            
                    
                        <b>1.15.2.5.</b>
                    
                    工厂方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.2.6" data-path="../../设计模式/创建模型/抽象工厂.html">
            
                <a href="../../设计模式/创建模型/抽象工厂.html">
            
                    
                        <b>1.15.2.6.</b>
                    
                    抽象工厂
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.2.7" data-path="../../设计模式/创建模型/简单工厂.html">
            
                <a href="../../设计模式/创建模型/简单工厂.html">
            
                    
                        <b>1.15.2.7.</b>
                    
                    简单工厂
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15.3" data-path="../../设计模式/结构型模型/">
            
                <a href="../../设计模式/结构型模型/">
            
                    
                        <b>1.15.3.</b>
                    
                    结构型模型
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.3.1" data-path="../../设计模式/结构型模型/readme.html">
            
                <a href="../../设计模式/结构型模型/readme.html">
            
                    
                        <b>1.15.3.1.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3.2" data-path="../../设计模式/结构型模型/享元模式.html">
            
                <a href="../../设计模式/结构型模型/享元模式.html">
            
                    
                        <b>1.15.3.2.</b>
                    
                    享元模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3.3" data-path="../../设计模式/结构型模型/代理模式.html">
            
                <a href="../../设计模式/结构型模型/代理模式.html">
            
                    
                        <b>1.15.3.3.</b>
                    
                    代理模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3.4" data-path="../../设计模式/结构型模型/外观模式.html">
            
                <a href="../../设计模式/结构型模型/外观模式.html">
            
                    
                        <b>1.15.3.4.</b>
                    
                    外观模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3.5" data-path="../../设计模式/结构型模型/桥模式.html">
            
                <a href="../../设计模式/结构型模型/桥模式.html">
            
                    
                        <b>1.15.3.5.</b>
                    
                    桥模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3.6" data-path="../../设计模式/结构型模型/组合模式.html">
            
                <a href="../../设计模式/结构型模型/组合模式.html">
            
                    
                        <b>1.15.3.6.</b>
                    
                    组合模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3.7" data-path="../../设计模式/结构型模型/装饰模式.html">
            
                <a href="../../设计模式/结构型模型/装饰模式.html">
            
                    
                        <b>1.15.3.7.</b>
                    
                    装饰模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3.8" data-path="../../设计模式/结构型模型/适配器模式.html">
            
                <a href="../../设计模式/结构型模型/适配器模式.html">
            
                    
                        <b>1.15.3.8.</b>
                    
                    适配器模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15.4" data-path="../../设计模式/行为型模型/">
            
                <a href="../../设计模式/行为型模型/">
            
                    
                        <b>1.15.4.</b>
                    
                    行为型模型
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.4.1" data-path="../../设计模式/行为型模型/readme.html">
            
                <a href="../../设计模式/行为型模型/readme.html">
            
                    
                        <b>1.15.4.1.</b>
                    
                    Readme
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4.2" data-path="../../设计模式/行为型模型/中介者模式.html">
            
                <a href="../../设计模式/行为型模型/中介者模式.html">
            
                    
                        <b>1.15.4.2.</b>
                    
                    中介者模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4.3" data-path="../../设计模式/行为型模型/命令模式.html">
            
                <a href="../../设计模式/行为型模型/命令模式.html">
            
                    
                        <b>1.15.4.3.</b>
                    
                    命令模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4.4" data-path="../../设计模式/行为型模型/备忘录模式.html">
            
                <a href="../../设计模式/行为型模型/备忘录模式.html">
            
                    
                        <b>1.15.4.4.</b>
                    
                    备忘录模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4.5" data-path="../../设计模式/行为型模型/模板方法模式.html">
            
                <a href="../../设计模式/行为型模型/模板方法模式.html">
            
                    
                        <b>1.15.4.5.</b>
                    
                    模板方法模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4.6" data-path="../../设计模式/行为型模型/状态模式.html">
            
                <a href="../../设计模式/行为型模型/状态模式.html">
            
                    
                        <b>1.15.4.6.</b>
                    
                    状态模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4.7" data-path="../../设计模式/行为型模型/策略模式.html">
            
                <a href="../../设计模式/行为型模型/策略模式.html">
            
                    
                        <b>1.15.4.7.</b>
                    
                    策略模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4.8" data-path="../../设计模式/行为型模型/职责链模式.html">
            
                <a href="../../设计模式/行为型模型/职责链模式.html">
            
                    
                        <b>1.15.4.8.</b>
                    
                    职责链模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4.9" data-path="../../设计模式/行为型模型/观察者模式.html">
            
                <a href="../../设计模式/行为型模型/观察者模式.html">
            
                    
                        <b>1.15.4.9.</b>
                    
                    观察者模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4.10" data-path="../../设计模式/行为型模型/解释器模式.html">
            
                <a href="../../设计模式/行为型模型/解释器模式.html">
            
                    
                        <b>1.15.4.10.</b>
                    
                    解释器模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4.11" data-path="../../设计模式/行为型模型/访问者模式.html">
            
                <a href="../../设计模式/行为型模型/访问者模式.html">
            
                    
                        <b>1.15.4.11.</b>
                    
                    访问者模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4.12" data-path="../../设计模式/行为型模型/迭代器模式.html">
            
                <a href="../../设计模式/行为型模型/迭代器模式.html">
            
                    
                        <b>1.15.4.12.</b>
                    
                    迭代器模式
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../.." >Ebpf</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <p>&#x4F5C;&#x8005; <strong><a href="https://www.do1618.com/" target="_blank">&#x72C4;&#x536B;&#x534E;</a></strong> &#x53D1;&#x8868;&#x4E8E; <strong>2020&#x5E74;8&#x6708;9&#x65E5;</strong></p>
<p>&#x201C;eBPF &#x662F;&#x6211;&#x89C1;&#x8FC7;&#x7684; Linux &#x4E2D;&#x6700;&#x795E;&#x5947;&#x7684;&#x6280;&#x672F;&#xFF0C;&#x6CA1;&#x6709;&#x4E4B;&#x4E00;&#xFF0C;&#x5DF2;&#x6210;&#x4E3A; Linux &#x5185;&#x6838;&#x4E2D;&#x9876;&#x7EA7;&#x5B50;&#x6A21;&#x5757;&#xFF0C;&#x4ECE; tcpdump &#x4E2D;&#x7528;&#x4F5C;&#x7F51;&#x7EDC;&#x5305;&#x8FC7;&#x6EE4;&#x7684;&#x7ECF;&#x5178; cbpf&#xFF0C;&#x5230;&#x6210;&#x4E3A;&#x901A;&#x7528; Linux &#x5185;&#x6838;&#x6280;&#x672F;&#x7684; eBPF&#xFF0C;&#x5DF2;&#x7ECF;&#x5B8C;&#x6210;&#x534E;&#x4E3D;&#x8715;&#x53D8;&#xFF0C;&#x4E3A;&#x5E94;&#x7528;&#x4E0E;&#x795E;&#x5947;&#x7684;&#x5185;&#x6838;&#x6253;&#x9020;&#x4E86;&#x4E00;&#x5EA7;&#x6865;&#x6881;&#xFF0C;&#x5728;&#x7CFB;&#x7EDF;&#x8DDF;&#x8E2A;&#x3001;&#x89C2;&#x6D4B;&#x3001;&#x6027;&#x80FD;&#x8C03;&#x4F18;&#x3001;&#x5B89;&#x5168;&#x548C;&#x7F51;&#x7EDC;&#x7B49;&#x9886;&#x57DF;&#x53D1;&#x6325;&#x91CD;&#x8981;&#x7684;&#x89D2;&#x8272;&#x3002;&#x4E3A; Service Mesh &#x6253;&#x9020;&#x4E86;&#x5177;&#x5907; API &#x611F;&#x77E5;&#x548C;&#x5B89;&#x5168;&#x9AD8;&#x6548;&#x7684;&#x5BB9;&#x5668;&#x7F51;&#x7EDC;&#x65B9;&#x6848; Cilium&#xFF0C;&#x5176;&#x5E95;&#x5C42;&#x6B63;&#x662F;&#x57FA;&#x4E8E; eBPF &#x6280;&#x672F;&#x201D;</p>
<h2 id="1-bpf"><a name="1-bpf" class="anchor-navigation-ex-anchor" href="#1-bpf"><i class="fa fa-link" aria-hidden="true"></i></a>1. BPF</h2>
<p>BPF&#xFF08;Berkeley Packet Filter &#xFF09;&#xFF0C;&#x4E2D;&#x6587;&#x7FFB;&#x8BD1;&#x4E3A;&#x4F2F;&#x514B;&#x5229;&#x5305;&#x8FC7;&#x6EE4;&#x5668;&#xFF0C;&#x662F;&#x7C7B; Unix &#x7CFB;&#x7EDF;&#x4E0A;&#x6570;&#x636E;&#x94FE;&#x8DEF;&#x5C42;&#x7684;&#x4E00;&#x79CD;&#x539F;&#x59CB;&#x63A5;&#x53E3;&#xFF0C;&#x63D0;&#x4F9B;&#x539F;&#x59CB;&#x94FE;&#x8DEF;&#x5C42;&#x5C01;&#x5305;&#x7684;&#x6536;&#x53D1;&#x3002;1992 &#x5E74;&#xFF0C;Steven McCanne &#x548C; Van Jacobson &#x5199;&#x4E86;&#x4E00;&#x7BC7;&#x540D;&#x4E3A;&#x300A;BSD&#x6570;&#x636E;&#x5305;&#x8FC7;&#x6EE4;&#xFF1A;&#x4E00;&#x79CD;&#x65B0;&#x7684;&#x7528;&#x6237;&#x7EA7;&#x5305;&#x6355;&#x83B7;&#x67B6;&#x6784;&#x300B;&#x7684;&#x8BBA;&#x6587;&#x3002;&#x5728;&#x6587;&#x4E2D;&#xFF0C;&#x4F5C;&#x8005;&#x63CF;&#x8FF0;&#x4E86;&#x4ED6;&#x4EEC;&#x5982;&#x4F55;&#x5728; Unix &#x5185;&#x6838;&#x5B9E;&#x73B0;&#x7F51;&#x7EDC;&#x6570;&#x636E;&#x5305;&#x8FC7;&#x6EE4;&#xFF0C;&#x8FD9;&#x79CD;&#x65B0;&#x7684;&#x6280;&#x672F;&#x6BD4;&#x5F53;&#x65F6;&#x6700;&#x5148;&#x8FDB;&#x7684;&#x6570;&#x636E;&#x5305;&#x8FC7;&#x6EE4;&#x6280;&#x672F;&#x5FEB; 20 &#x500D;&#x3002;BPF &#x5728;&#x6570;&#x636E;&#x5305;&#x8FC7;&#x6EE4;&#x4E0A;&#x5F15;&#x5165;&#x4E86;&#x4E24;&#x5927;&#x9769;&#x65B0;&#xFF1A;</p>
<ul>
<li>&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x865A;&#x62DF;&#x673A; (VM) &#x8BBE;&#x8BA1;&#xFF0C;&#x53EF;&#x4EE5;&#x6709;&#x6548;&#x5730;&#x5DE5;&#x4F5C;&#x5728;&#x57FA;&#x4E8E;&#x5BC4;&#x5B58;&#x5668;&#x7ED3;&#x6784;&#x7684; CPU &#x4E4B;&#x4E0A;&#xFF1B;</li>
<li>&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4F7F;&#x7528;&#x7F13;&#x5B58;&#x53EA;&#x590D;&#x5236;&#x4E0E;&#x8FC7;&#x6EE4;&#x6570;&#x636E;&#x5305;&#x76F8;&#x5173;&#x7684;&#x6570;&#x636E;&#xFF0C;&#x4E0D;&#x4F1A;&#x590D;&#x5236;&#x6570;&#x636E;&#x5305;&#x7684;&#x6240;&#x6709;&#x4FE1;&#x606F;&#x3002;&#x8FD9;&#x6837;&#x53EF;&#x4EE5;&#x6700;&#x5927;&#x7A0B;&#x5EA6;&#x5730;&#x51CF;&#x5C11;BPF &#x5904;&#x7406;&#x7684;&#x6570;&#x636E;&#xFF1B;</li>
</ul>
<p>&#x7531;&#x4E8E;&#x8FD9;&#x4E9B;&#x5DE8;&#x5927;&#x7684;&#x6539;&#x8FDB;&#xFF0C;&#x6240;&#x6709;&#x7684; Unix &#x7CFB;&#x7EDF;&#x90FD;&#x9009;&#x62E9;&#x91C7;&#x7528; BPF &#x4F5C;&#x4E3A;&#x7F51;&#x7EDC;&#x6570;&#x636E;&#x5305;&#x8FC7;&#x6EE4;&#x6280;&#x672F;&#xFF0C;&#x76F4;&#x5230;&#x4ECA;&#x5929;&#xFF0C;&#x8BB8;&#x591A; Unix &#x5185;&#x6838;&#x7684;&#x6D3E;&#x751F;&#x7CFB;&#x7EDF;&#x4E2D;&#xFF08;&#x5305;&#x62EC; Linux &#x5185;&#x6838;&#xFF09;&#x4ECD;&#x4F7F;&#x7528;&#x8BE5;&#x5B9E;&#x73B0;&#x3002;</p>
<p>tcpdump &#x7684;&#x5E95;&#x5C42;&#x91C7;&#x7528; BPF &#x4F5C;&#x4E3A;&#x5E95;&#x5C42;&#x5305;&#x8FC7;&#x6EE4;&#x6280;&#x672F;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5728;&#x547D;&#x4EE4;&#x540E;&#x9762;&#x589E;&#x52A0; &#x201D;-d&#x201C; &#x6765;&#x67E5;&#x770B; tcpdump &#x8FC7;&#x6EE4;&#x6761;&#x4EF6;&#x7684;&#x5E95;&#x5C42;&#x6C47;&#x7F16;&#x6307;&#x4EE4;&#x3002;</p>
<pre class="language-"><code class="lang-bash">$ tcpdump -d <span class="token string">&apos;ip and tcp port 8080&apos;</span>
<span class="token punctuation">(</span>000<span class="token punctuation">)</span> ldh      <span class="token punctuation">[</span><span class="token number">12</span><span class="token punctuation">]</span>
<span class="token punctuation">(</span>001<span class="token punctuation">)</span> jeq      <span class="token comment">#0x800           jt 2    jf 12</span>
<span class="token punctuation">(</span>002<span class="token punctuation">)</span> ldb      <span class="token punctuation">[</span><span class="token number">23</span><span class="token punctuation">]</span>
<span class="token punctuation">(</span>003<span class="token punctuation">)</span> jeq      <span class="token comment">#0x6             jt 4    jf 12</span>
<span class="token punctuation">(</span>004<span class="token punctuation">)</span> ldh      <span class="token punctuation">[</span><span class="token number">20</span><span class="token punctuation">]</span>
<span class="token punctuation">(</span>005<span class="token punctuation">)</span> jset     <span class="token comment">#0x1fff          jt 12    jf 6</span>
<span class="token punctuation">(</span>006<span class="token punctuation">)</span> ldxb     <span class="token number">4</span>*<span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token number">14</span><span class="token punctuation">]</span><span class="token operator">&amp;</span>0xf<span class="token punctuation">)</span>
<span class="token punctuation">(</span>007<span class="token punctuation">)</span> ldh      <span class="token punctuation">[</span>x + <span class="token number">14</span><span class="token punctuation">]</span>
<span class="token punctuation">(</span>008<span class="token punctuation">)</span> jeq      <span class="token comment">#0x1f90          jt 11    jf 9</span>
<span class="token punctuation">(</span>009<span class="token punctuation">)</span> ldh      <span class="token punctuation">[</span>x + <span class="token number">16</span><span class="token punctuation">]</span>
<span class="token punctuation">(</span>010<span class="token punctuation">)</span> jeq      <span class="token comment">#0x1f90          jt 11    jf 12</span>
<span class="token punctuation">(</span>011<span class="token punctuation">)</span> ret      <span class="token comment">#262144</span>
<span class="token punctuation">(</span>012<span class="token punctuation">)</span> ret      <span class="token comment">#0</span>
</code></pre>
<p>&#x56FE; 1-1 tcpdump &#x5E95;&#x5C42;&#x6C47;&#x7F16;&#x6307;&#x4EE4;</p>
<p>BPF &#x5DE5;&#x4F5C;&#x5728;&#x5185;&#x6838;&#x5C42;&#xFF0C;BPF &#x7684;&#x67B6;&#x6784;&#x56FE;&#x5982;&#x4E0B; [&#x6765;&#x81EA;&#x4E8E;bpf-usenix93]&#xFF1A;</p>
<p><img src="https://cloudnative.to/blog/bpf-intro/tcpdump-bpf.png" alt="img"></p>
<p>&#x56FE; 1-2 tcpdump &#x8FD0;&#x884C;&#x67B6;&#x6784;</p>
<h2 id="2-ebpf"><a name="2-ebpf" class="anchor-navigation-ex-anchor" href="#2-ebpf"><i class="fa fa-link" aria-hidden="true"></i></a>2. eBPF</h2>
<h3 id="21-ebpf-&#x4ECB;&#x7ECD;"><a name="21-ebpf-&#x4ECB;&#x7ECD;" class="anchor-navigation-ex-anchor" href="#21-ebpf-&#x4ECB;&#x7ECD;"><i class="fa fa-link" aria-hidden="true"></i></a>2.1 eBPF &#x4ECB;&#x7ECD;</h3>
<p>2014 &#x5E74;&#x521D;&#xFF0C;Alexei Starovoitov &#x5B9E;&#x73B0;&#x4E86; eBPF&#xFF08;extended Berkeley Packet Filter&#xFF09;&#x3002;&#x7ECF;&#x8FC7;&#x91CD;&#x65B0;&#x8BBE;&#x8BA1;&#xFF0C;eBPF &#x6F14;&#x8FDB;&#x4E3A;&#x4E00;&#x4E2A;&#x901A;&#x7528;&#x6267;&#x884C;&#x5F15;&#x64CE;&#xFF0C;&#x53EF;&#x57FA;&#x4E8E;&#x6B64;&#x5F00;&#x53D1;&#x6027;&#x80FD;&#x5206;&#x6790;&#x5DE5;&#x5177;&#x3001;&#x8F6F;&#x4EF6;&#x5B9A;&#x4E49;&#x7F51;&#x7EDC;&#x7B49;&#x8BF8;&#x591A;&#x573A;&#x666F;&#x3002;eBPF &#x6700;&#x65E9;&#x51FA;&#x73B0;&#x5728; 3.18 &#x5185;&#x6838;&#x4E2D;&#xFF0C;&#x6B64;&#x540E;&#x539F;&#x6765;&#x7684; BPF &#x5C31;&#x88AB;&#x79F0;&#x4E3A;&#x7ECF;&#x5178; BPF&#xFF0C;&#x7F29;&#x5199; cBPF&#xFF08;classic BPF&#xFF09;&#xFF0C;cBPF &#x73B0;&#x5728;&#x5DF2;&#x7ECF;&#x57FA;&#x672C;&#x5E9F;&#x5F03;&#x3002;&#x73B0;&#x5728;&#xFF0C;Linux &#x5185;&#x6838;&#x53EA;&#x8FD0;&#x884C; eBPF&#xFF0C;&#x5185;&#x6838;&#x4F1A;&#x5C06;&#x52A0;&#x8F7D;&#x7684; cBPF &#x5B57;&#x8282;&#x7801;&#x900F;&#x660E;&#x5730;&#x8F6C;&#x6362;&#x6210; eBPF &#x518D;&#x6267;&#x884C;&#x3002;</p>
<p>eBPF &#x65B0;&#x7684;&#x8BBE;&#x8BA1;&#x9488;&#x5BF9;&#x73B0;&#x4EE3;&#x786C;&#x4EF6;&#x8FDB;&#x884C;&#x4E86;&#x4F18;&#x5316;&#xFF0C;&#x6240;&#x4EE5; eBPF &#x751F;&#x6210;&#x7684;&#x6307;&#x4EE4;&#x96C6;&#x6BD4;&#x65E7;&#x7684; BPF &#x89E3;&#x91CA;&#x5668;&#x751F;&#x6210;&#x7684;&#x673A;&#x5668;&#x7801;&#x6267;&#x884C;&#x5F97;&#x66F4;&#x5FEB;&#x3002;&#x6269;&#x5C55;&#x7248;&#x672C;&#x4E5F;&#x589E;&#x52A0;&#x4E86;&#x865A;&#x62DF;&#x673A;&#x4E2D;&#x7684;&#x5BC4;&#x5B58;&#x5668;&#x6570;&#x91CF;&#xFF0C;&#x5C06;&#x539F;&#x6709;&#x7684; 2 &#x4E2A; 32 &#x4F4D;&#x5BC4;&#x5B58;&#x5668;&#x589E;&#x52A0;&#x5230; 10 &#x4E2A; 64 &#x4F4D;&#x5BC4;&#x5B58;&#x5668;&#x3002;&#x7531;&#x4E8E;&#x5BC4;&#x5B58;&#x5668;&#x6570;&#x91CF;&#x548C;&#x5BBD;&#x5EA6;&#x7684;&#x589E;&#x52A0;&#xFF0C;&#x5F00;&#x53D1;&#x4EBA;&#x5458;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x51FD;&#x6570;&#x53C2;&#x6570;&#x81EA;&#x7531;&#x4EA4;&#x6362;&#x66F4;&#x591A;&#x7684;&#x4FE1;&#x606F;&#xFF0C;&#x7F16;&#x5199;&#x66F4;&#x590D;&#x6742;&#x7684;&#x7A0B;&#x5E8F;&#x3002;&#x603B;&#x4E4B;&#xFF0C;&#x8FD9;&#x4E9B;&#x6539;&#x8FDB;&#x4F7F; eBPF &#x7248;&#x672C;&#x7684;&#x901F;&#x5EA6;&#x6BD4;&#x539F;&#x6765;&#x7684; BPF &#x63D0;&#x9AD8;&#x4E86; 4 &#x500D;&#x3002;</p>
<table>
<thead>
<tr>
<th>&#x7EF4;&#x5EA6;</th>
<th>cBPF</th>
<th>eBPF</th>
</tr>
</thead>
<tbody>
<tr>
<td>&#x5185;&#x6838;&#x7248;&#x672C;</td>
<td>Linux 2.1.75&#xFF08;1997&#x5E74;&#xFF09;</td>
<td>Linux 3.18&#xFF08;2014&#x5E74;&#xFF09;[4.x for kprobe/uprobe/tracepoint/perf-event]</td>
</tr>
<tr>
<td>&#x5BC4;&#x5B58;&#x5668;&#x6570;&#x76EE;</td>
<td>2&#x4E2A;&#xFF1A;A, X</td>
<td>10&#x4E2A;&#xFF1A; R0&#x2013;R9, &#x53E6;&#x5916; R10 &#x662F;&#x4E00;&#x4E2A;&#x53EA;&#x8BFB;&#x7684;&#x5E27;&#x6307;&#x9488;</td>
</tr>
<tr>
<td>&#x5BC4;&#x5B58;&#x5668;&#x5BBD;&#x5EA6;</td>
<td>32&#x4F4D;</td>
<td>64&#x4F4D;</td>
</tr>
<tr>
<td>&#x5B58;&#x50A8;</td>
<td>16 &#x4E2A;&#x5185;&#x5B58;&#x4F4D;: M[0&#x2013;15]</td>
<td>512 &#x5B57;&#x8282;&#x5806;&#x6808;&#xFF0C;&#x65E0;&#x9650;&#x5236;&#x5927;&#x5C0F;&#x7684; &#x201C;map&#x201D; &#x5B58;&#x50A8;</td>
</tr>
<tr>
<td>&#x9650;&#x5236;&#x7684;&#x5185;&#x6838;&#x8C03;&#x7528;</td>
<td>&#x975E;&#x5E38;&#x6709;&#x9650;&#xFF0C;&#x4EC5;&#x9650;&#x4E8E; JIT &#x7279;&#x5B9A;</td>
<td>&#x6709;&#x9650;&#xFF0C;&#x901A;&#x8FC7; bpf_call &#x6307;&#x4EE4;&#x8C03;&#x7528;</td>
</tr>
<tr>
<td>&#x76EE;&#x6807;&#x4E8B;&#x4EF6;</td>
<td>&#x6570;&#x636E;&#x5305;&#x3001; seccomp-BPF</td>
<td>&#x6570;&#x636E;&#x5305;&#x3001;&#x5185;&#x6838;&#x51FD;&#x6570;&#x3001;&#x7528;&#x6237;&#x51FD;&#x6570;&#x3001;&#x8DDF;&#x8E2A;&#x70B9; PMCs &#x7B49;</td>
</tr>
</tbody>
</table>
<p>&#x8868;&#x683C; 1-1 cBPF &#x4E0E; eBPF &#x5BF9;&#x6BD4;</p>
<blockquote>
<p>eBPF &#x5728; Linux 3.18 &#x7248;&#x672C;&#x4EE5;&#x540E;&#x5F15;&#x5165;&#xFF0C;&#x5E76;&#x4E0D;&#x4EE3;&#x8868;&#x53EA;&#x80FD;&#x5728;&#x5185;&#x6838; 3.18+ &#x7248;&#x672C;&#x4E0A;&#x8FD0;&#x884C;&#xFF0C;&#x4F4E;&#x7248;&#x672C;&#x7684;&#x5185;&#x6838;&#x5347;&#x7EA7;&#x5230;&#x6700;&#x65B0;&#x4E5F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; eBPF &#x80FD;&#x529B;&#xFF0C;&#x53EA;&#x662F;&#x53EF;&#x80FD;&#x90E8;&#x5206;&#x529F;&#x80FD;&#x53D7;&#x9650;&#xFF0C;&#x6BD4;&#x5982;&#x6211;&#x5C31;&#x662F;&#x5728; Linux &#x53D1;&#x884C;&#x7248;&#x672C; CentOS Linux release 7.7.1908 &#x5185;&#x6838;&#x7248;&#x672C; 3.10.0-1062.9.1.el7.x86_64 &#x4E0A;&#x8FD0;&#x884C; eBPF &#x5728;&#x751F;&#x4EA7;&#x73AF;&#x5883;&#x4E0A;&#x641C;&#x96C6;&#x548C;&#x6392;&#x67E5;&#x7F51;&#x7EDC;&#x95EE;&#x9898;&#x3002;</p>
</blockquote>
<p>eBPF &#x5B9E;&#x73B0;&#x7684;&#x6700;&#x521D;&#x76EE;&#x6807;&#x662F;&#x4F18;&#x5316;&#x5904;&#x7406;&#x7F51;&#x7EDC;&#x8FC7;&#x6EE4;&#x5668;&#x7684;&#x5185;&#x90E8; BPF &#x6307;&#x4EE4;&#x96C6;&#x3002;&#x5F53;&#x65F6;&#xFF0C;BPF &#x7A0B;&#x5E8F;&#x4ECD;&#x7136;&#x9650;&#x4E8E;&#x5185;&#x6838;&#x7A7A;&#x95F4;&#x4F7F;&#x7528;&#xFF0C;&#x53EA;&#x6709;&#x5C11;&#x6570;&#x7528;&#x6237;&#x7A7A;&#x95F4;&#x7A0B;&#x5E8F;&#x53EF;&#x4EE5;&#x7F16;&#x5199;&#x5185;&#x6838;&#x5904;&#x7406;&#x7684; BPF &#x8FC7;&#x6EE4;&#x5668;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;tcpdump&#x548C; seccomp&#x3002;&#x65F6;&#x81F3;&#x4ECA;&#x65E5;&#xFF0C;&#x8FD9;&#x4E9B;&#x7A0B;&#x5E8F;&#x4ECD;&#x57FA;&#x4E8E;&#x65E7;&#x7684; BPF &#x89E3;&#x91CA;&#x5668;&#x751F;&#x6210;&#x5B57;&#x8282;&#x7801;&#xFF0C;&#x4F46;&#x5185;&#x6838;&#x4E2D;&#x4F1A;&#x5C06;&#x8FD9;&#x4E9B;&#x6307;&#x4EE4;&#x8F6C;&#x6362;&#x4E3A;&#x9AD8;&#x6027;&#x80FD;&#x7684;&#x8868;&#x793A;&#x3002;</p>
<p>2014 &#x5E74; 6 &#x6708;&#xFF0C;<strong>eBPF &#x6269;&#x5C55;&#x5230;&#x7528;&#x6237;&#x7A7A;&#x95F4;&#xFF0C;&#x8FD9;&#x4E5F;&#x6210;&#x4E3A;&#x4E86; BPF &#x6280;&#x672F;&#x7684;&#x8F6C;&#x6298;&#x70B9;</strong>&#x3002; &#x6B63;&#x5982; Alexei &#x5728;&#x63D0;&#x4EA4;&#x8865;&#x4E01;&#x7684;&#x6CE8;&#x91CA;&#x4E2D;&#x5199;&#x5230;&#xFF1A;&#x201C;&#x8FD9;&#x4E2A;&#x8865;&#x4E01;&#x5C55;&#x793A;&#x4E86; eBPF &#x7684;&#x6F5C;&#x529B;&#x201D;&#x3002;&#x5F53;&#x524D;&#xFF0C;eBPF &#x4E0D;&#x518D;&#x5C40;&#x9650;&#x4E8E;&#x7F51;&#x7EDC;&#x6808;&#xFF0C;&#x5DF2;&#x7ECF;&#x6210;&#x4E3A;&#x5185;&#x6838;&#x9876;&#x7EA7;&#x7684;&#x5B50;&#x7CFB;&#x7EDF;&#x3002;eBPF &#x7A0B;&#x5E8F;&#x67B6;&#x6784;&#x5F3A;&#x8C03;&#x5B89;&#x5168;&#x6027;&#x548C;&#x7A33;&#x5B9A;&#x6027;&#xFF0C;&#x770B;&#x4E0A;&#x53BB;&#x66F4;&#x50CF;&#x5185;&#x6838;&#x6A21;&#x5757;&#xFF0C;&#x4F46;&#x4E0E;&#x5185;&#x6838;&#x6A21;&#x5757;&#x4E0D;&#x540C;&#xFF0C;eBPF &#x7A0B;&#x5E8F;&#x4E0D;&#x9700;&#x8981;&#x91CD;&#x65B0;&#x7F16;&#x8BD1;&#x5185;&#x6838;&#xFF0C;&#x5E76;&#x4E14;&#x53EF;&#x4EE5;&#x786E;&#x4FDD; eBPF &#x7A0B;&#x5E8F;&#x8FD0;&#x884C;&#x5B8C;&#x6210;&#xFF0C;&#x800C;&#x4E0D;&#x4F1A;&#x9020;&#x6210;&#x7CFB;&#x7EDF;&#x7684;&#x5D29;&#x6E83;&#x3002;</p>
<p><img src="https://cloudnative.to/blog/bpf-intro/bpf-basic-arch.png" alt="img"></p>
<p>&#x56FE; 2-1 BPF &#x67B6;&#x6784;&#x56FE;</p>
<p>&#x7B80;&#x8FF0;&#x6982;&#x62EC;&#xFF0C; eBPF &#x662F;&#x4E00;&#x5957;&#x901A;&#x7528;&#x6267;&#x884C;&#x5F15;&#x64CE;&#xFF0C;&#x63D0;&#x4F9B;&#x4E86;&#x53EF;&#x57FA;&#x4E8E;&#x7CFB;&#x7EDF;&#x6216;&#x7A0B;&#x5E8F;&#x4E8B;&#x4EF6;&#x9AD8;&#x6548;&#x5B89;&#x5168;&#x6267;&#x884C;&#x7279;&#x5B9A;&#x4EE3;&#x7801;&#x7684;&#x901A;&#x7528;&#x80FD;&#x529B;&#xFF0C;&#x901A;&#x7528;&#x80FD;&#x529B;&#x7684;&#x4F7F;&#x7528;&#x8005;&#x4E0D;&#x518D;&#x5C40;&#x9650;&#x4E8E;&#x5185;&#x6838;&#x5F00;&#x53D1;&#x8005;&#xFF1B;eBPF &#x53EF;&#x7531;&#x6267;&#x884C;&#x5B57;&#x8282;&#x7801;&#x6307;&#x4EE4;&#x3001;&#x5B58;&#x50A8;&#x5BF9;&#x8C61;&#x548C; Helper &#x5E2E;&#x52A9;&#x51FD;&#x6570;&#x7EC4;&#x6210;&#xFF0C;&#x5B57;&#x8282;&#x7801;&#x6307;&#x4EE4;&#x5728;&#x5185;&#x6838;&#x6267;&#x884C;&#x524D;&#x5FC5;&#x987B;&#x901A;&#x8FC7; BPF &#x9A8C;&#x8BC1;&#x5668; Verfier &#x7684;&#x9A8C;&#x8BC1;&#xFF0C;&#x540C;&#x65F6;&#x5728;&#x542F;&#x7528; BPF JIT &#x6A21;&#x5F0F;&#x7684;&#x5185;&#x6838;&#x4E2D;&#xFF0C;&#x4F1A;&#x76F4;&#x63A5;&#x5C06;&#x5B57;&#x8282;&#x7801;&#x6307;&#x4EE4;&#x8F6C;&#x6210;&#x5185;&#x6838;&#x53EF;&#x6267;&#x884C;&#x7684;&#x672C;&#x5730;&#x6307;&#x4EE4;&#x8FD0;&#x884C;&#x3002;</p>
<p>&#x540C;&#x65F6;&#xFF0C;eBPF &#x4E5F;&#x9010;&#x6E10;&#x5728;&#x89C2;&#x6D4B;&#xFF08;&#x8DDF;&#x8E2A;&#x3001;&#x6027;&#x80FD;&#x8C03;&#x4F18;&#x7B49;&#xFF09;&#x3001;&#x5B89;&#x5168;&#x548C;&#x7F51;&#x7EDC;&#x7B49;&#x9886;&#x57DF;&#x53D1;&#x6325;&#x91CD;&#x8981;&#x7684;&#x89D2;&#x8272;&#x3002;Facebook&#x3001;NetFlix &#x3001;CloudFlare &#x7B49;&#x77E5;&#x540D;&#x4E92;&#x8054;&#x7F51;&#x516C;&#x53F8;&#x5185;&#x90E8;&#x5E7F;&#x6CDB;&#x91C7;&#x7528;&#x57FA;&#x4E8E; eBPF &#x6280;&#x672F;&#x7684;&#x5404;&#x79CD;&#x7A0B;&#x5E8F;&#x7528;&#x4E8E;&#x6027;&#x80FD;&#x5206;&#x6790;&#x3001;&#x6392;&#x67E5;&#x95EE;&#x9898;&#x3001;&#x8D1F;&#x8F7D;&#x5747;&#x8861;&#x3001;&#x9632;&#x8303; DDoS &#x653B;&#x51FB;&#xFF0C;&#x636E;&#x76F8;&#x5173;&#x4FE1;&#x606F;&#x663E;&#x793A;&#x5728; Facebook &#x7684;&#x673A;&#x5668;&#x4E0A;&#x5185;&#x7F6E;&#x4E00;&#x7CFB;&#x5217; eBPF &#x7684;&#x76F8;&#x5173;&#x5DE5;&#x5177;&#x3002;</p>
<p>&#x76F8;&#x5BF9;&#x4E8E;&#x7CFB;&#x7EDF;&#x7684;&#x6027;&#x80FD;&#x5206;&#x6790;&#x548C;&#x89C2;&#x6D4B;&#xFF0C;eBPF &#x6280;&#x672F;&#x5728;&#x7F51;&#x7EDC;&#x6280;&#x672F;&#x4E2D;&#x7684;&#x8868;&#x73B0;&#xFF0C;&#x66F4;&#x662F;&#x8BA9;&#x4EBA;&#x773C;&#x524D;&#x4E00;&#x4EAE;&#xFF0C;BPF &#x6280;&#x672F;&#x4E0E; XDP&#xFF08;eXpress Data Path&#xFF09; &#x548C; TC&#xFF08;Traffic Control&#xFF09; &#x7EC4;&#x5408;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0;&#x529F;&#x80FD;&#x66F4;&#x52A0;&#x5F3A;&#x5927;&#x7684;&#x7F51;&#x7EDC;&#x529F;&#x80FD;&#xFF0C;&#x66F4;&#x53EF;&#x4E3A; SDN &#x8F6F;&#x4EF6;&#x5B9A;&#x4E49;&#x7F51;&#x7EDC;&#x63D0;&#x4F9B;&#x57FA;&#x7840;&#x652F;&#x6491;&#x3002;XDP &#x53EA;&#x4F5C;&#x7528;&#x4E0E;&#x7F51;&#x7EDC;&#x5305;&#x7684; Ingress &#x5C42;&#x9762;&#xFF0C;BPF &#x94A9;&#x5B50;&#x4F4D;&#x4E8E;<strong>&#x7F51;&#x7EDC;&#x9A71;&#x52A8;&#x4E2D;&#x5C3D;&#x53EF;&#x80FD;&#x65E9;&#x7684;&#x4F4D;&#x7F6E;</strong>&#xFF0C;<strong>&#x65E0;&#x9700;&#x8FDB;&#x884C;&#x539F;&#x59CB;&#x5305;&#x7684;&#x590D;&#x5236;</strong>&#x5C31;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0;&#x6700;&#x4F73;&#x7684;&#x6570;&#x636E;&#x5305;&#x5904;&#x7406;&#x6027;&#x80FD;&#xFF0C;&#x6302;&#x8F7D;&#x7684; BPF &#x7A0B;&#x5E8F;&#x662F;&#x8FD0;&#x884C;&#x8FC7;&#x6EE4;&#x7684;&#x7406;&#x60F3;&#x9009;&#x62E9;&#xFF0C;&#x53EF;&#x7528;&#x4E8E;&#x4E22;&#x5F03;&#x6076;&#x610F;&#x6216;&#x975E;&#x9884;&#x671F;&#x7684;&#x6D41;&#x91CF;&#x3001;&#x8FDB;&#x884C; DDOS &#x653B;&#x51FB;&#x4FDD;&#x62A4;&#x7B49;&#x573A;&#x666F;&#xFF1B;&#x800C; TC Ingress &#x6BD4; XDP &#x6280;&#x672F;&#x5904;&#x4E8E;&#x66F4;&#x9AD8;&#x5C42;&#x6B21;&#x7684;&#x4F4D;&#x7F6E;&#xFF0C;BPF &#x7A0B;&#x5E8F;&#x5728; L3 &#x5C42;&#x4E4B;&#x524D;&#x8FD0;&#x884C;&#xFF0C;&#x53EF;&#x4EE5;&#x8BBF;&#x95EE;&#x5230;&#x4E0E;&#x6570;&#x636E;&#x5305;&#x76F8;&#x5173;&#x7684;&#x5927;&#x90E8;&#x5206;&#x5143;&#x6570;&#x636E;&#xFF0C;&#x662F;&#x672C;&#x5730;&#x8282;&#x70B9;&#x5904;&#x7406;&#x7684;&#x7406;&#x60F3;&#x7684;&#x5730;&#x65B9;&#xFF0C;&#x53EF;&#x4EE5;&#x7528;&#x4E8E;&#x6D41;&#x91CF;&#x76D1;&#x63A7;&#x6216;&#x8005; L3/L4 &#x7684;&#x7AEF;&#x70B9;&#x7B56;&#x7565;&#x63A7;&#x5236;&#xFF0C;&#x540C;&#x65F6;&#x914D;&#x5408; TC egress &#x5219;&#x53EF;&#x5B9E;&#x73B0;&#x5BF9;&#x4E8E;&#x5BB9;&#x5668;&#x73AF;&#x5883;&#x4E0B;&#x66F4;&#x9AD8;&#x7EF4;&#x5EA6;&#x548C;&#x7EA7;&#x522B;&#x7684;&#x7F51;&#x7EDC;&#x7ED3;&#x6784;&#x3002;</p>
<p><img src="https://cloudnative.to/blog/bpf-intro/packet-processor-xdp.png" alt="img"></p>
<p>&#x56FE; 2-2 XDP &#x6280;&#x672F;&#x67B6;&#x6784;</p>
<p>eBPF &#x76F8;&#x5173;&#x7684;&#x77E5;&#x540D;&#x7684;&#x5F00;&#x6E90;&#x9879;&#x76EE;&#x5305;&#x62EC;&#x4F46;&#x4E0D;&#x9650;&#x4E8E;&#x4EE5;&#x4E0B;&#xFF1A;</p>
<ul>
<li>Facebook &#x9AD8;&#x6027;&#x80FD; 4 &#x5C42;&#x8D1F;&#x8F7D;&#x5747;&#x8861;&#x5668; <a href="https://github.com/facebookincubator/katran" target="_blank">Katran</a>&#xFF1B;</li>
<li><a href="https://cilium.io/" target="_blank">Cilium</a> &#x4E3A;&#x4E0B;&#x4E00;&#x4EE3;&#x5FAE;&#x670D;&#x52A1; ServiceMesh &#x6253;&#x9020;&#x4E86;&#x5177;&#x5907;API&#x611F;&#x77E5;&#x548C;&#x5B89;&#x5168;&#x9AD8;&#x6548;&#x7684;&#x5BB9;&#x5668;&#x7F51;&#x7EDC;&#x65B9;&#x6848;&#xFF1B;&#x5E95;&#x5C42;&#x4E3B;&#x8981;&#x4F7F;&#x7528; XDP &#x548C; TC &#x7B49;&#x76F8;&#x5173;&#x6280;&#x672F;&#xFF1B;</li>
<li>IO Visor &#x9879;&#x76EE;&#x5F00;&#x6E90;&#x7684; <a href="https://github.com/iovisor/bcc" target="_blank">BCC</a>&#x3001; <a href="https://github.com/iovisor/bpftrace" target="_blank">BPFTrace</a> &#x548C; <a href="https://github.com/iovisor/kubectl-trace" target="_blank">Kubectl-Trace</a>&#xFF1A; <a href="https://github.com/iovisor/bcc" target="_blank">BCC</a> &#x63D0;&#x4F9B;&#x4E86;&#x66F4;&#x9AD8;&#x9636;&#x7684;&#x62BD;&#x8C61;&#xFF0C;&#x53EF;&#x4EE5;&#x8BA9;&#x7528;&#x6237;&#x91C7;&#x7528; Python&#x3001;C++ &#x548C; Lua &#x7B49;&#x9AD8;&#x7EA7;&#x8BED;&#x8A00;&#x5FEB;&#x901F;&#x5F00;&#x53D1; BPF &#x7A0B;&#x5E8F;&#xFF1B;<a href="https://github.com/iovisor/bpftrace" target="_blank">BPFTrace</a> &#x91C7;&#x7528;&#x7C7B;&#x4F3C;&#x4E8E; awk &#x8BED;&#x8A00;&#x5FEB;&#x901F;&#x7F16;&#x5199; eBPF &#x7A0B;&#x5E8F;&#xFF1B;<a href="https://github.com/iovisor/kubectl-trace" target="_blank">Kubectl-Trace</a> &#x5219;&#x63D0;&#x4F9B;&#x4E86;&#x5728; kubernetes &#x96C6;&#x7FA4;&#x4E2D;&#x4F7F;&#x7528; BPF &#x7A0B;&#x5E8F;&#x8C03;&#x8BD5;&#x7684;&#x65B9;&#x4FBF;&#x64CD;&#x4F5C;&#xFF1B;</li>
<li>CloudFlare &#x516C;&#x53F8;&#x5F00;&#x6E90;&#x7684; <a href="https://github.com/cloudflare/ebpf_exporter" target="_blank">eBPF Exporter</a> &#x548C; <a href="https://github.com/cloudflare/bpftools" target="_blank">bpf-tools</a>&#xFF1A;<a href="https://github.com/cloudflare/ebpf_exporter" target="_blank">eBPF Exporter</a> &#x5C06; eBPF &#x6280;&#x672F;&#x4E0E;&#x76D1;&#x63A7; Prometheus &#x7D27;&#x5BC6;&#x7ED3;&#x5408;&#x8D77;&#x6765;&#xFF1B;<a href="https://github.com/cloudflare/bpftools" target="_blank">bpf-tools</a> &#x53EF;&#x7528;&#x4E8E;&#x7F51;&#x7EDC;&#x95EE;&#x9898;&#x5206;&#x6790;&#x548C;&#x6392;&#x67E5;&#xFF1B;</li>
</ul>
<p>&#x8D8A;&#x6765;&#x8D8A;&#x591A;&#x7684;&#x57FA;&#x4E8E; eBPF &#x7684;&#x9879;&#x76EE;&#x5982;&#x96E8;&#x540E;&#x8106;&#x7B0B;&#x4E00;&#x6837;&#x5F00;&#x59CB;&#x84EC;&#x52C3;&#x53D1;&#x5C55;&#xFF0C;&#x800C;&#x4E14;&#x9010;&#x6B65;&#x5728;&#x793E;&#x533A;&#x4E2D;&#x5F02;&#x519B;&#x7A81;&#x8D77;&#xFF0C;&#x6210;&#x4E3A;&#x4E00;&#x9053;&#x98CE;&#x666F;&#x7EBF;&#x3002;&#x6BD4;&#x5982; IO Visor &#x9879;&#x76EE;&#x7684; BCC &#x5DE5;&#x5177;&#xFF0C;&#x4E3A;&#x6027;&#x80FD;&#x5206;&#x6790;&#x548C;&#x89C2;&#x5BDF;&#x63D0;&#x4F9B;&#x4E86;&#x66F4;&#x52A0;&#x4E30;&#x5BCC;&#x7684;&#x5DE5;&#x5177;&#x96C6;&#xFF1A;<a href="https://github.com/iovisor/bcc" target="_blank">&#x56FE;&#x7247;&#x6765;&#x6E90;</a></p>
<p><img src="https://cloudnative.to/blog/bpf-intro/bcc-tools.png" alt="img"></p>
<p>&#x56FE; 2-3 Linux bcc/BPF &#x89C2;&#x6D4B;&#x5DE5;&#x5177;</p>
<p>&#x540C;&#x65F6;&#xFF0C;IO Visor &#x7684; <a href="https://github.com/iovisor/bpf-docs" target="_blank">bpf-docs</a> &#x5305;&#x542B;&#x4E86;&#x65E5;&#x5E38;&#x7684;&#x6587;&#x6863;&#xFF0C;&#x53EF;&#x4EE5;&#x7528;&#x4E8E;&#x5B66;&#x4E60;&#x3002;</p>
<blockquote>
<p>&#x7531;&#x4E8E; eBPF &#x8FD8;&#x5728;&#x5FEB;&#x901F;&#x53D1;&#x5C55;&#x671F;&#xFF0C;&#x5185;&#x6838;&#x4E2D;&#x7684;&#x529F;&#x80FD;&#x4E5F;&#x65E5;&#x8D8B;&#x589E;&#x5F3A;&#xFF0C;&#x4E00;&#x822C;&#x63A8;&#x8350;&#x57FA;&#x4E8E;Linux 4.4+ (4.9 &#x4EE5;&#x4E0A;&#x4F1A;&#x66F4;&#x597D;) &#x5185;&#x6838;&#x7684;&#x6765;&#x4F7F;&#x7528; eBPF&#x3002;&#x90E8;&#x5206; Linux Event &#x548C; BPF &#x7248;&#x672C;&#x652F;&#x6301;&#x89C1;&#x4E0B;&#x56FE;&#xFF1A;</p>
<p><img src="https://cloudnative.to/blog/bpf-intro/linux_kernel_event_bpf.png" alt="img"></p>
<p>&#x56FE; 2-4 Linux &#x4E8B;&#x4EF6;&#x548C; BPF &#x7248;&#x672C;&#x652F;&#x6301;</p>
</blockquote>
<h3 id="22-ebpf-&#x67B6;&#x6784;&#xFF08;&#x89C2;&#x6D4B;&#xFF09;"><a name="22-ebpf-&#x67B6;&#x6784;&#xFF08;&#x89C2;&#x6D4B;&#xFF09;" class="anchor-navigation-ex-anchor" href="#22-ebpf-&#x67B6;&#x6784;&#xFF08;&#x89C2;&#x6D4B;&#xFF09;"><i class="fa fa-link" aria-hidden="true"></i></a>2.2 eBPF &#x67B6;&#x6784;&#xFF08;&#x89C2;&#x6D4B;&#xFF09;</h3>
<p>&#x57FA;&#x4E8E; Linux &#x7CFB;&#x7EDF;&#x7684;&#x89C2;&#x6D4B;&#x5DE5;&#x5177;&#x4E2D;&#xFF0C;eBPF &#x6709;&#x7740;&#x5F97;&#x5929;&#x72EC;&#x539A;&#x7684;&#x4F18;&#x52BF;&#xFF0C;&#x9AD8;&#x6548;&#x3001;&#x751F;&#x4EA7;&#x5B89;&#x5168;&#x4E14;&#x5185;&#x6838;&#x4E2D;&#x5185;&#x7F6E;&#xFF0C;&#x7279;&#x522B;&#x7684;&#x53EF;&#x4EE5;&#x5728;&#x5185;&#x6838;&#x4E2D;&#x5B8C;&#x6210;&#x6570;&#x636E;&#x5206;&#x6790;&#x805A;&#x5408;&#x6BD4;&#x5982;&#x76F4;&#x65B9;&#x56FE;&#xFF0C;&#x4E0E;&#x5C06;&#x6570;&#x636E;&#x53D1;&#x9001;&#x5230;&#x7528;&#x6237;&#x7A7A;&#x95F4;&#x5206;&#x6790;&#x805A;&#x5408;&#x76F8;&#x6BD4;&#xFF0C;&#x80FD;&#x591F;&#x8282;&#x7701;&#x5927;&#x91CF;&#x7684;&#x6570;&#x636E;&#x590D;&#x5236;&#x4F20;&#x9012;&#x5E26;&#x6765;&#x7684; CPU &#x6D88;&#x8017;&#x3002;</p>
<p>eBPF &#x6574;&#x4F53;&#x7ED3;&#x6784;&#x56FE;&#x5982;&#x4E0B;&#xFF1A;</p>
<p><img src="https://cloudnative.to/blog/bpf-intro/linux_ebpf_internals.png" alt="img"></p>
<p>&#x56FE; 2-5 eBPF &#x89C2;&#x6D4B;&#x67B6;&#x6784;</p>
<p>eBPF &#x5206;&#x4E3A;&#x7528;&#x6237;&#x7A7A;&#x95F4;&#x7A0B;&#x5E8F;&#x548C;&#x5185;&#x6838;&#x7A0B;&#x5E8F;&#x4E24;&#x90E8;&#x5206;&#xFF1A;</p>
<ul>
<li>&#x7528;&#x6237;&#x7A7A;&#x95F4;&#x7A0B;&#x5E8F;&#x8D1F;&#x8D23;&#x52A0;&#x8F7D; BPF &#x5B57;&#x8282;&#x7801;&#x81F3;&#x5185;&#x6838;&#xFF0C;&#x5982;&#x9700;&#x8981;&#x4E5F;&#x4F1A;&#x8D1F;&#x8D23;&#x8BFB;&#x53D6;&#x5185;&#x6838;&#x56DE;&#x4F20;&#x7684;&#x7EDF;&#x8BA1;&#x4FE1;&#x606F;&#x6216;&#x8005;&#x4E8B;&#x4EF6;&#x8BE6;&#x60C5;&#xFF1B;</li>
<li>&#x5185;&#x6838;&#x4E2D;&#x7684; BPF &#x5B57;&#x8282;&#x7801;&#x8D1F;&#x8D23;&#x5728;&#x5185;&#x6838;&#x4E2D;&#x6267;&#x884C;&#x7279;&#x5B9A;&#x4E8B;&#x4EF6;&#xFF0C;&#x5982;&#x9700;&#x8981;&#x4E5F;&#x4F1A;&#x5C06;&#x6267;&#x884C;&#x7684;&#x7ED3;&#x679C;&#x901A;&#x8FC7; maps &#x6216;&#x8005; perf-event &#x4E8B;&#x4EF6;&#x53D1;&#x9001;&#x81F3;&#x7528;&#x6237;&#x7A7A;&#x95F4;&#xFF1B;</li>
</ul>
<p>&#x5176;&#x4E2D;&#x7528;&#x6237;&#x7A7A;&#x95F4;&#x7A0B;&#x5E8F;&#x4E0E;&#x5185;&#x6838; BPF &#x5B57;&#x8282;&#x7801;&#x7A0B;&#x5E8F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; map &#x7ED3;&#x6784;&#x5B9E;&#x73B0;&#x53CC;&#x5411;&#x901A;&#x4FE1;&#xFF0C;&#x8FD9;&#x4E3A;&#x5185;&#x6838;&#x4E2D;&#x8FD0;&#x884C;&#x7684; BPF &#x5B57;&#x8282;&#x7801;&#x7A0B;&#x5E8F;&#x63D0;&#x4F9B;&#x4E86;&#x66F4;&#x52A0;&#x7075;&#x6D3B;&#x7684;&#x63A7;&#x5236;&#x3002;</p>
<p>&#x7528;&#x6237;&#x7A7A;&#x95F4;&#x7A0B;&#x5E8F;&#x4E0E;&#x5185;&#x6838;&#x4E2D;&#x7684; BPF &#x5B57;&#x8282;&#x7801;&#x4EA4;&#x4E92;&#x7684;&#x6D41;&#x7A0B;&#x4E3B;&#x8981;&#x5982;&#x4E0B;&#xFF1A;</p>
<ol>
<li>&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; LLVM &#x6216;&#x8005; GCC &#x5DE5;&#x5177;&#x5C06;&#x7F16;&#x5199;&#x7684; BPF &#x4EE3;&#x7801;&#x7A0B;&#x5E8F;&#x7F16;&#x8BD1;&#x6210; BPF &#x5B57;&#x8282;&#x7801;&#xFF1B;</li>
<li>&#x7136;&#x540E;&#x4F7F;&#x7528;&#x52A0;&#x8F7D;&#x7A0B;&#x5E8F; Loader &#x5C06;&#x5B57;&#x8282;&#x7801;&#x52A0;&#x8F7D;&#x81F3;&#x5185;&#x6838;&#xFF1B;&#x5185;&#x6838;&#x4F7F;&#x7528;&#x9A8C;&#x8BC1;&#x5668;&#xFF08;verfier&#xFF09; &#x7EC4;&#x4EF6;&#x4FDD;&#x8BC1;&#x6267;&#x884C;&#x5B57;&#x8282;&#x7801;&#x7684;&#x5B89;&#x5168;&#x6027;&#xFF0C;&#x4EE5;&#x907F;&#x514D;&#x5BF9;&#x5185;&#x6838;&#x9020;&#x6210;&#x707E;&#x96BE;&#xFF0C;&#x5728;&#x786E;&#x8BA4;&#x5B57;&#x8282;&#x7801;&#x5B89;&#x5168;&#x540E;&#x5C06;&#x5176;&#x52A0;&#x8F7D;&#x5BF9;&#x5E94;&#x7684;&#x5185;&#x6838;&#x6A21;&#x5757;&#x6267;&#x884C;&#xFF1B;BPF &#x89C2;&#x6D4B;&#x6280;&#x672F;&#x76F8;&#x5173;&#x7684;&#x7A0B;&#x5E8F;&#x7A0B;&#x5E8F;&#x7C7B;&#x578B;&#x53EF;&#x80FD;&#x662F; kprobes/uprobes/tracepoint/perf_events &#x4E2D;&#x7684;&#x4E00;&#x4E2A;&#x6216;&#x591A;&#x4E2A;&#xFF0C;&#x5176;&#x4E2D;&#xFF1A;<ul>
<li><strong>kprobes</strong>&#xFF1A;&#x5B9E;&#x73B0;&#x5185;&#x6838;&#x4E2D;&#x52A8;&#x6001;&#x8DDF;&#x8E2A;&#x3002; kprobes &#x53EF;&#x4EE5;&#x8DDF;&#x8E2A;&#x5230; Linux &#x5185;&#x6838;&#x4E2D;&#x7684;&#x5BFC;&#x51FA;&#x51FD;&#x6570;&#x5165;&#x53E3;&#x6216;&#x8FD4;&#x56DE;&#x70B9;&#xFF0C;&#x4F46;&#x662F;&#x4E0D;&#x662F;&#x7A33;&#x5B9A; ABI &#x63A5;&#x53E3;&#xFF0C;&#x53EF;&#x80FD;&#x4F1A;&#x56E0;&#x4E3A;&#x5185;&#x6838;&#x7248;&#x672C;&#x53D8;&#x5316;&#x5BFC;&#x81F4;&#xFF0C;&#x5BFC;&#x81F4;&#x8DDF;&#x8E2A;&#x5931;&#x6548;&#x3002;</li>
<li><strong>uprobes</strong>&#xFF1A;&#x7528;&#x6237;&#x7EA7;&#x522B;&#x7684;&#x52A8;&#x6001;&#x8DDF;&#x8E2A;&#x3002;&#x4E0E; kprobes &#x7C7B;&#x4F3C;&#xFF0C;&#x53EA;&#x662F;&#x8DDF;&#x8E2A;&#x7528;&#x6237;&#x7A0B;&#x5E8F;&#x4E2D;&#x7684;&#x51FD;&#x6570;&#x3002;</li>
<li><strong>tracepoints</strong>&#xFF1A;&#x5185;&#x6838;&#x4E2D;&#x9759;&#x6001;&#x8DDF;&#x8E2A;&#x3002;tracepoints &#x662F;&#x5185;&#x6838;&#x5F00;&#x53D1;&#x4EBA;&#x5458;&#x7EF4;&#x62A4;&#x7684;&#x8DDF;&#x8E2A;&#x70B9;&#xFF0C;&#x80FD;&#x591F;&#x63D0;&#x4F9B;&#x7A33;&#x5B9A;&#x7684; ABI &#x63A5;&#x53E3;&#xFF0C;&#x4F46;&#x662F;&#x7531;&#x4E8E;&#x662F;&#x7814;&#x53D1;&#x4EBA;&#x5458;&#x7EF4;&#x62A4;&#xFF0C;&#x6570;&#x91CF;&#x548C;&#x573A;&#x666F;&#x53EF;&#x80FD;&#x53D7;&#x9650;&#x3002;</li>
<li><strong>perf_events</strong>&#xFF1A;&#x5B9A;&#x65F6;&#x91C7;&#x6837;&#x548C; PMC&#x3002;</li>
</ul>
</li>
<li>&#x5185;&#x6838;&#x4E2D;&#x8FD0;&#x884C;&#x7684; BPF &#x5B57;&#x8282;&#x7801;&#x7A0B;&#x5E8F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4E24;&#x79CD;&#x65B9;&#x5F0F;&#x5C06;&#x6D4B;&#x91CF;&#x6570;&#x636E;&#x56DE;&#x4F20;&#x81F3;&#x7528;&#x6237;&#x7A7A;&#x95F4;<ul>
<li><strong>maps</strong> &#x65B9;&#x5F0F;&#x53EF;&#x7528;&#x4E8E;&#x5C06;&#x5185;&#x6838;&#x4E2D;&#x5B9E;&#x73B0;&#x7684;&#x7EDF;&#x8BA1;&#x6458;&#x8981;&#x4FE1;&#x606F;&#xFF08;&#x6BD4;&#x5982;&#x6D4B;&#x91CF;&#x5EF6;&#x8FDF;&#x3001;&#x5806;&#x6808;&#x4FE1;&#x606F;&#xFF09;&#x7B49;&#x56DE;&#x4F20;&#x81F3;&#x7528;&#x6237;&#x7A7A;&#x95F4;&#xFF1B;</li>
<li><strong>perf-event</strong> &#x7528;&#x4E8E;&#x5C06;&#x5185;&#x6838;&#x91C7;&#x96C6;&#x7684;&#x4E8B;&#x4EF6;&#x5B9E;&#x65F6;&#x53D1;&#x9001;&#x81F3;&#x7528;&#x6237;&#x7A7A;&#x95F4;&#xFF0C;&#x7528;&#x6237;&#x7A7A;&#x95F4;&#x7A0B;&#x5E8F;&#x5B9E;&#x65F6;&#x8BFB;&#x53D6;&#x5206;&#x6790;&#xFF1B;</li>
</ul>
</li>
</ol>
<blockquote>
<p>&#x5982;&#x65E0;&#x7279;&#x6B8A;&#x8BF4;&#x660E;&#xFF0C;&#x672C;&#x6587;&#x4E2D;&#x6240;&#x8BF4;&#x7684; BPF &#x90FD;&#x662F;&#x6CDB;&#x6307; BPF &#x6280;&#x672F;&#x3002;</p>
</blockquote>
<h3 id="23-ebpf-&#x7684;&#x9650;&#x5236;"><a name="23-ebpf-&#x7684;&#x9650;&#x5236;" class="anchor-navigation-ex-anchor" href="#23-ebpf-&#x7684;&#x9650;&#x5236;"><i class="fa fa-link" aria-hidden="true"></i></a>2.3 eBPF &#x7684;&#x9650;&#x5236;</h3>
<p>eBPF &#x6280;&#x672F;&#x867D;&#x7136;&#x5F3A;&#x5927;&#xFF0C;&#x4F46;&#x662F;&#x4E3A;&#x4E86;&#x4FDD;&#x8BC1;&#x5185;&#x6838;&#x7684;&#x5904;&#x7406;&#x5B89;&#x5168;&#x548C;&#x53CA;&#x65F6;&#x54CD;&#x5E94;&#xFF0C;&#x5185;&#x6838;&#x4E2D;&#x7684; eBPF &#x6280;&#x672F;&#x4E5F;&#x7ED9;&#x4E88;&#x4E86;&#x8BF8;&#x591A;&#x9650;&#x5236;&#xFF0C;&#x5F53;&#x7136;&#x968F;&#x7740;&#x6280;&#x672F;&#x7684;&#x53D1;&#x5C55;&#x548C;&#x6F14;&#x8FDB;&#xFF0C;&#x9650;&#x5236;&#x4E5F;&#x5728;&#x9010;&#x6B65;&#x653E;&#x5BBD;&#x6216;&#x8005;&#x63D0;&#x4F9B;&#x4E86;&#x5BF9;&#x5E94;&#x7684;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#x3002;</p>
<ul>
<li><p>eBPF &#x7A0B;&#x5E8F;&#x4E0D;&#x80FD;&#x8C03;&#x7528;&#x4EFB;&#x610F;&#x7684;&#x5185;&#x6838;&#x53C2;&#x6570;&#xFF0C;&#x53EA;&#x9650;&#x4E8E;&#x5185;&#x6838;&#x6A21;&#x5757;&#x4E2D;&#x5217;&#x51FA;&#x7684; BPF Helper &#x51FD;&#x6570;&#xFF0C;&#x51FD;&#x6570;&#x652F;&#x6301;&#x5217;&#x8868;&#x4E5F;&#x968F;&#x7740;&#x5185;&#x6838;&#x7684;&#x6F14;&#x8FDB;&#x5728;&#x4E0D;&#x65AD;&#x589E;&#x52A0;&#x3002;</p>
</li>
<li><p>eBPF &#x7A0B;&#x5E8F;&#x4E0D;&#x5141;&#x8BB8;&#x5305;&#x542B;&#x65E0;&#x6CD5;&#x5230;&#x8FBE;&#x7684;&#x6307;&#x4EE4;&#xFF0C;&#x9632;&#x6B62;&#x52A0;&#x8F7D;&#x65E0;&#x6548;&#x4EE3;&#x7801;&#xFF0C;&#x5EF6;&#x8FDF;&#x7A0B;&#x5E8F;&#x7684;&#x7EC8;&#x6B62;&#x3002;</p>
</li>
<li><p>eBPF &#x7A0B;&#x5E8F;&#x4E2D;&#x5FAA;&#x73AF;&#x6B21;&#x6570;&#x9650;&#x5236;&#x4E14;&#x5FC5;&#x987B;&#x5728;&#x6709;&#x9650;&#x65F6;&#x95F4;&#x5185;&#x7ED3;&#x675F;&#xFF0C;&#x8FD9;&#x4E3B;&#x8981;&#x662F;&#x7528;&#x6765;&#x9632;&#x6B62;&#x5728; kprobes &#x4E2D;&#x63D2;&#x5165;&#x4EFB;&#x610F;&#x7684;&#x5FAA;&#x73AF;&#xFF0C;&#x5BFC;&#x81F4;&#x9501;&#x4F4F;&#x6574;&#x4E2A;&#x7CFB;&#x7EDF;&#xFF1B;&#x89E3;&#x51B3;&#x529E;&#x6CD5;&#x5305;&#x62EC;&#x5C55;&#x5F00;&#x5FAA;&#x73AF;&#xFF0C;&#x5E76;&#x4E3A;&#x9700;&#x8981;&#x5FAA;&#x73AF;&#x7684;&#x5E38;&#x89C1;&#x7528;&#x9014;&#x6DFB;&#x52A0;&#x8F85;&#x52A9;&#x51FD;&#x6570;&#x3002;Linux 5.3 &#x5728; BPF &#x4E2D;&#x5305;&#x542B;&#x4E86;&#x5BF9;&#x6709;&#x754C;&#x5FAA;&#x73AF;&#x7684;&#x652F;&#x6301;&#xFF0C;&#x5B83;&#x6709;&#x4E00;&#x4E2A;&#x53EF;&#x9A8C;&#x8BC1;&#x7684;&#x8FD0;&#x884C;&#x65F6;&#x95F4;&#x4E0A;&#x9650;&#x3002;</p>
</li>
<li><p>eBPF &#x5806;&#x6808;&#x5927;&#x5C0F;&#x88AB;&#x9650;&#x5236;&#x5728; MAX_BPF_STACK&#xFF0C;&#x622A;&#x6B62;&#x5230;&#x5185;&#x6838; Linux 5.8 &#x7248;&#x672C;&#xFF0C;&#x88AB;&#x8BBE;&#x7F6E;&#x4E3A; 512&#xFF1B;&#x53C2;&#x89C1; <a href="https://github.com/torvalds/linux/blob/v5.8/include/linux/filter.h" target="_blank">include/linux/filter.h</a>&#xFF0C;&#x8FD9;&#x4E2A;&#x9650;&#x5236;&#x7279;&#x522B;&#x662F;&#x5728;&#x6808;&#x4E0A;&#x5B58;&#x50A8;&#x591A;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;&#x7F13;&#x51B2;&#x533A;&#x65F6;&#xFF1A;&#x4E00;&#x4E2A;char[256]&#x7F13;&#x51B2;&#x533A;&#x4F1A;&#x6D88;&#x8017;&#x8FD9;&#x4E2A;&#x6808;&#x7684;&#x4E00;&#x534A;&#x3002;&#x76EE;&#x524D;&#x6CA1;&#x6709;&#x8BA1;&#x5212;&#x589E;&#x52A0;&#x8FD9;&#x4E2A;&#x9650;&#x5236;&#xFF0C;&#x89E3;&#x51B3;&#x65B9;&#x6CD5;&#x662F;&#x6539;&#x7528; bpf &#x6620;&#x5C04;&#x5B58;&#x50A8;&#xFF0C;&#x5B83;&#x5B9E;&#x9645;&#x4E0A;&#x662F;&#x65E0;&#x9650;&#x7684;&#x3002;</p>
<pre class="language-"><code class="lang-c"><span class="token comment">/* BPF program can access up to 512 bytes of stack space. */</span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">define</span> <span class="token macro-name">MAX_BPF_STACK</span>    <span class="token expression"><span class="token number">512</span></span></span>
</code></pre>
</li>
<li><p>eBPF &#x5B57;&#x8282;&#x7801;&#x5927;&#x5C0F;&#x6700;&#x521D;&#x88AB;&#x9650;&#x5236;&#x4E3A; 4096 &#x6761;&#x6307;&#x4EE4;&#xFF0C;&#x622A;&#x6B62;&#x5230;&#x5185;&#x6838; Linux 5.8 &#x7248;&#x672C;&#xFF0C; &#x5F53;&#x524D;&#x5DF2;&#x5C06;&#x653E;&#x5BBD;&#x81F3; 100 &#x4E07;&#x6307;&#x4EE4;&#xFF08; BPF_COMPLEXITY_LIMIT_INSNS&#xFF09;&#xFF0C;&#x53C2;&#x89C1;&#xFF1A;<a href="https://github.com/torvalds/linux/blob/v5.8/include/linux/bpf.h" target="_blank">include/linux/bpf.h</a>&#xFF0C;&#x5BF9;&#x4E8E;&#x65E0;&#x6743;&#x9650;&#x7684;BPF&#x7A0B;&#x5E8F;&#xFF0C;&#x4ECD;&#x7136;&#x4FDD;&#x7559; 4096 &#x6761;&#x9650;&#x5236; ( BPF_MAXINSNS )&#xFF1B;&#x65B0;&#x7248;&#x672C;&#x7684; eBPF &#x4E5F;&#x652F;&#x6301;&#x4E86;&#x591A;&#x4E2A; eBPF &#x7A0B;&#x5E8F;&#x7EA7;&#x8054;&#x8C03;&#x7528;&#xFF0C;&#x867D;&#x7136;&#x4F20;&#x9012;&#x4FE1;&#x606F;&#x5B58;&#x5728;&#x67D0;&#x4E9B;&#x9650;&#x5236;&#xFF0C;&#x4F46;&#x662F;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x7EC4;&#x5408;&#x5B9E;&#x73B0;&#x66F4;&#x52A0;&#x5F3A;&#x5927;&#x7684;&#x529F;&#x80FD;&#x3002;</p>
<pre class="language-"><code class="lang-c"><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">define</span> <span class="token macro-name">BPF_COMPLEXITY_LIMIT_INSNS</span>      <span class="token expression"><span class="token number">1000000</span> </span><span class="token comment">/* yes. 1M insns */</span></span>
</code></pre>
</li>
</ul>
<h3 id="24-ebpf-&#x4E0E;&#x5185;&#x6838;&#x6A21;&#x5757;&#x5BF9;&#x6BD4;"><a name="24-ebpf-&#x4E0E;&#x5185;&#x6838;&#x6A21;&#x5757;&#x5BF9;&#x6BD4;" class="anchor-navigation-ex-anchor" href="#24-ebpf-&#x4E0E;&#x5185;&#x6838;&#x6A21;&#x5757;&#x5BF9;&#x6BD4;"><i class="fa fa-link" aria-hidden="true"></i></a>2.4 eBPF &#x4E0E;&#x5185;&#x6838;&#x6A21;&#x5757;&#x5BF9;&#x6BD4;</h3>
<p>&#x5728; Linux &#x89C2;&#x6D4B;&#x65B9;&#x9762;&#xFF0C;eBPF &#x603B;&#x662F;&#x4F1A;&#x62FF;&#x6765;&#x4E0E; kernel &#x6A21;&#x5757;&#x65B9;&#x5F0F;&#x8FDB;&#x884C;&#x5BF9;&#x6BD4;&#xFF0C;eBPF &#x5728;&#x5B89;&#x5168;&#x6027;&#x3001;&#x5165;&#x95E8;&#x95E8;&#x69DB;&#x4E0A;&#x6BD4;&#x5185;&#x6838;&#x6A21;&#x5757;&#x90FD;&#x6709;&#x4F18;&#x52BF;&#xFF0C;&#x8FD9;&#x4E24;&#x70B9;&#x5728;&#x89C2;&#x6D4B;&#x573A;&#x666F;&#x4E0B;&#x5BF9;&#x4E8E;&#x7528;&#x6237;&#x6765;&#x8BB2;&#x5C24;&#x5176;&#x91CD;&#x8981;&#x3002;</p>
<table>
<thead>
<tr>
<th>&#x7EF4;&#x5EA6;</th>
<th>Linux &#x5185;&#x6838;&#x6A21;&#x5757;</th>
<th>eBPF</th>
</tr>
</thead>
<tbody>
<tr>
<td>kprobes/tracepoints</td>
<td>&#x652F;&#x6301;</td>
<td>&#x652F;&#x6301;</td>
</tr>
<tr>
<td><strong>&#x5B89;&#x5168;&#x6027;</strong></td>
<td>&#x53EF;&#x80FD;&#x5F15;&#x5165;&#x5B89;&#x5168;&#x6F0F;&#x6D1E;&#x6216;&#x5BFC;&#x81F4;&#x5185;&#x6838; Panic</td>
<td>&#x901A;&#x8FC7;&#x9A8C;&#x8BC1;&#x5668;&#x8FDB;&#x884C;&#x68C0;&#x67E5;&#xFF0C;&#x53EF;&#x4EE5;&#x4FDD;&#x969C;&#x5185;&#x6838;&#x5B89;&#x5168;</td>
</tr>
<tr>
<td>&#x5185;&#x6838;&#x51FD;&#x6570;</td>
<td>&#x53EF;&#x4EE5;&#x8C03;&#x7528;&#x5185;&#x6838;&#x51FD;&#x6570;</td>
<td>&#x53EA;&#x80FD;&#x901A;&#x8FC7; BPF Helper &#x51FD;&#x6570;&#x8C03;&#x7528;</td>
</tr>
<tr>
<td>&#x7F16;&#x8BD1;&#x6027;</td>
<td>&#x9700;&#x8981;&#x7F16;&#x8BD1;&#x5185;&#x6838;</td>
<td>&#x4E0D;&#x9700;&#x8981;&#x7F16;&#x8BD1;&#x5185;&#x6838;&#xFF0C;&#x5F15;&#x5165;&#x5934;&#x6587;&#x4EF6;&#x5373;&#x53EF;</td>
</tr>
<tr>
<td>&#x8FD0;&#x884C;</td>
<td>&#x57FA;&#x4E8E;&#x76F8;&#x540C;&#x5185;&#x6838;&#x8FD0;&#x884C;</td>
<td>&#x57FA;&#x4E8E;&#x7A33;&#x5B9A; ABI &#x7684; BPF &#x7A0B;&#x5E8F;&#x53EF;&#x4EE5;&#x7F16;&#x8BD1;&#x4E00;&#x6B21;&#xFF0C;&#x5404;&#x5904;&#x8FD0;&#x884C;</td>
</tr>
<tr>
<td>&#x4E0E;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4EA4;&#x4E92;</td>
<td>&#x6253;&#x5370;&#x65E5;&#x5FD7;&#x6216;&#x6587;&#x4EF6;</td>
<td>&#x901A;&#x8FC7; perf_event &#x6216; map &#x7ED3;&#x6784;</td>
</tr>
<tr>
<td>&#x6570;&#x636E;&#x7ED3;&#x6784;&#x4E30;&#x5BCC;&#x6027;</td>
<td>&#x4E00;&#x822C;</td>
<td>&#x4E30;&#x5BCC;</td>
</tr>
<tr>
<td><strong>&#x5165;&#x95E8;&#x95E8;&#x69DB;</strong></td>
<td>&#x9AD8;</td>
<td>&#x4F4E;</td>
</tr>
<tr>
<td><strong>&#x5347;&#x7EA7;</strong></td>
<td>&#x9700;&#x8981;&#x5378;&#x8F7D;&#x548C;&#x52A0;&#x8F7D;&#xFF0C;&#x53EF;&#x80FD;&#x5BFC;&#x81F4;&#x5904;&#x7406;&#x6D41;&#x7A0B;&#x4E2D;&#x65AD;</td>
<td>&#x539F;&#x5B50;&#x66FF;&#x6362;&#x5347;&#x7EA7;&#xFF0C;&#x4E0D;&#x4F1A;&#x9020;&#x6210;&#x5904;&#x7406;&#x6D41;&#x7A0B;&#x4E2D;&#x65AD;</td>
</tr>
<tr>
<td>&#x5185;&#x6838;&#x5185;&#x7F6E;</td>
<td>&#x89C6;&#x60C5;&#x51B5;&#x800C;&#x5B9A;</td>
<td>&#x5185;&#x6838;&#x5185;&#x7F6E;&#x652F;&#x6301;</td>
</tr>
</tbody>
</table>
<p>&#x8868;&#x683C; 2-1 eBPF &#x4E0E; Linux &#x5185;&#x6838;&#x6A21;&#x5757;&#x65B9;&#x5F0F;&#x5BF9;&#x6BD4;</p>
<h2 id="3-&#x5E94;&#x7528;&#x6848;&#x4F8B;"><a name="3-&#x5E94;&#x7528;&#x6848;&#x4F8B;" class="anchor-navigation-ex-anchor" href="#3-&#x5E94;&#x7528;&#x6848;&#x4F8B;"><i class="fa fa-link" aria-hidden="true"></i></a>3. &#x5E94;&#x7528;&#x6848;&#x4F8B;</h2>
<p>&#x5927;&#x540D;&#x9F0E;&#x9F0E;&#x7684;&#x6027;&#x80FD;&#x5206;&#x6790;&#x5927;&#x5E08; Brendan Gregg &#x7B49;&#x7F16;&#x5199;&#x4E86;&#x8BF8;&#x591A;&#x7684; BCC &#x6216; BPFTrace &#x7684;&#x5DE5;&#x5177;&#x96C6;&#x53EF;&#x4EE5;&#x62FF;&#x6765;&#x76F4;&#x63A5;&#x4F7F;&#x7528;&#xFF0C;&#x5B8C;&#x5168;&#x53EF;&#x4EE5;&#x6EE1;&#x8DB3;&#x6211;&#x4EEC;&#x65E5;&#x5E38;&#x95EE;&#x9898;&#x5206;&#x6790;&#x548C;&#x6392;&#x67E5;&#x3002;</p>
<p>BCC &#x5728; CentOS 7 &#x7CFB;&#x7EDF;&#x4E2D;&#x53EF;&#x4EE5;&#x901A;&#x8FC7; yum &#x5FEB;&#x901F;&#x5B89;&#x88C5;</p>
<pre class="language-"><code class="lang-bash"><span class="token comment"># yum install bcc -y</span>
Resolving Dependencies
--<span class="token operator">&gt;</span> Running transaction check
---<span class="token operator">&gt;</span> Package bcc.x86_64 <span class="token number">0</span>:0.8.0-1.el7 will be updated
--<span class="token operator">&gt;</span> Processing Dependency: bcc<span class="token punctuation">(</span>x86-64<span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token number">0.8</span>.0-1.el7 <span class="token keyword">for</span> package: python-bcc-0.8.0-1.el7.x86_64
---<span class="token operator">&gt;</span> Package bcc.x86_64 <span class="token number">0</span>:0.10.0-1.el7 will be an update
--<span class="token operator">&gt;</span> Processing Dependency: bcc-tools <span class="token operator">=</span> <span class="token number">0.10</span>.0-1.el7 <span class="token keyword">for</span> package: bcc-0.10.0-1.el7.x86_64
--<span class="token operator">&gt;</span> Running transaction check
---<span class="token operator">&gt;</span> Package bcc-tools.x86_64 <span class="token number">0</span>:0.8.0-1.el7 will be updated
---<span class="token operator">&gt;</span> Package bcc-tools.x86_64 <span class="token number">0</span>:0.10.0-1.el7 will be an update
---<span class="token operator">&gt;</span> Package python-bcc.x86_64 <span class="token number">0</span>:0.8.0-1.el7 will be updated
---<span class="token operator">&gt;</span> Package python-bcc.x86_64 <span class="token number">0</span>:0.10.0-1.el7 will be an update
--<span class="token operator">&gt;</span> Finished Dependency Resolution
<span class="token punctuation">..</span>.
</code></pre>
<p>&#x5176;&#x4ED6;&#x7CFB;&#x7EDF;&#x7684;&#x5B89;&#x88C5;&#x65B9;&#x5F0F;&#x53C2;&#x89C1;&#xFF1A;<a href="https://github.com/iovisor/bcc/blob/master/INSTALL.md" target="_blank">INSTALL.md</a></p>
<p>BCC &#x4E2D;&#x6BCF;&#x4E00;&#x4E2A;&#x5DE5;&#x5177;&#x90FD;&#x6709;&#x4E00;&#x4E2A;&#x5BF9;&#x5E94;&#x7684;&#x4F7F;&#x7528;&#x6837;&#x4F8B;&#xFF0C;&#x6BD4;&#x5982; <a href="https://github.com/iovisor/bcc/blob/master/tools/execsnoop.py" target="_blank">execsnoop.py</a> &#x548C; <a href="https://github.com/iovisor/bcc/blob/master/tools/execsnoop_example.txt" target="_blank">execsnoop_example.txt</a>&#xFF0C;&#x5728;&#x4F7F;&#x7528;&#x6837;&#x4F8B;&#x4E2D;&#x6709;&#x8BE6;&#x7EC6;&#x7684;&#x4F7F;&#x7528;&#x8BF4;&#x660E;&#xFF0C;&#x800C;&#x4E14; BCC &#x4E2D;&#x7684;&#x5DE5;&#x5177;&#x4F7F;&#x7528;&#x7684;&#x5E2E;&#x52A9;&#x6587;&#x6863;&#x683C;&#x5F0F;&#x57FA;&#x672C;&#x7C7B;&#x4F3C;&#xFF0C;&#x4E0A;&#x624B;&#x975E;&#x5E38;&#x65B9;&#x4FBF;&#x3002;</p>
<blockquote>
<p>BCC &#x7684;&#x7A0B;&#x5E8F;&#x4E00;&#x822C;&#x60C5;&#x51B5;&#x4E0B;&#x90FD;&#x9700;&#x8981; root &#x7528;&#x6237;&#x6765;&#x8FD0;&#x884C;&#x3002;</p>
</blockquote>
<h3 id="31-linux-&#x6027;&#x80FD;&#x5206;&#x6790;-60-&#x79D2;-&#xFF08;bpf&#x7248;&#x672C;&#xFF09;"><a name="31-linux-&#x6027;&#x80FD;&#x5206;&#x6790;-60-&#x79D2;-&#xFF08;bpf&#x7248;&#x672C;&#xFF09;" class="anchor-navigation-ex-anchor" href="#31-linux-&#x6027;&#x80FD;&#x5206;&#x6790;-60-&#x79D2;-&#xFF08;bpf&#x7248;&#x672C;&#xFF09;"><i class="fa fa-link" aria-hidden="true"></i></a>3.1 Linux &#x6027;&#x80FD;&#x5206;&#x6790; 60 &#x79D2; &#xFF08;BPF&#x7248;&#x672C;&#xFF09;</h3>
<p>&#x82F1;&#x6587;&#x539F;&#x6587; <a href="https://netflixtechblog.com/linux-performance-analysis-in-60-000-milliseconds-accc10403c55" target="_blank">Linux Performance Analysis in 60,000 Milliseconds</a>&#xFF0C;<a href="http://www.brendangregg.com/blog/2015-12-03/linux-perf-60s-video.html" target="_blank">&#x89C6;&#x9891;&#x5730;&#x5740;</a></p>
<pre class="language-"><code class="lang-bash"><span class="token function">uptime</span>
<span class="token function">dmesg</span> <span class="token operator">|</span> <span class="token function">tail</span>
<span class="token function">vmstat</span> <span class="token number">1</span>
mpstat -P ALL <span class="token number">1</span>
pidstat <span class="token number">1</span>
iostat -xz <span class="token number">1</span>
<span class="token function">free</span> -m
sar -n DEV <span class="token number">1</span>
sar -n TCP,ETCP <span class="token number">1</span>
<span class="token function">top</span>
</code></pre>
<p><strong>60s &#x7CFB;&#x5217; BPF &#x7248;&#x672C;&#x5982;&#x4E0B;&#xFF1A;</strong></p>
<p>&#x56FE; 3-1 60s &#x6392;&#x67E5;&#x4E4B; BPF &#x7248;&#x672C;</p>
<p>&#x5BF9;&#x4E8E;&#x5728;&#x7CFB;&#x7EDF;&#x4E2D;&#x8FD0;&#x884C;&#x7684; &#x201C;&#x95EA;&#x7535;&#x4FA0;&#x201D; &#x7A0B;&#x5E8F;&#xFF0C;&#x8FD0;&#x884C;&#x5468;&#x671F;&#x975E;&#x5E38;&#x77ED;&#xFF0C;&#x4F46;&#x662F;&#x53EF;&#x80FD;&#x4F1A;&#x5E26;&#x6765;&#x7CFB;&#x7EDF;&#x7684;&#x6296;&#x52A8;&#x5EF6;&#x65F6;&#xFF0C;&#x6211;&#x4EEC;&#x91C7;&#x7528; <code>top</code> &#x547D;&#x4EE4;&#x67E5;&#x770B;&#x4E00;&#x822C;&#x60C5;&#x51B5;&#x4E0B;&#x96BE;&#x4EE5;&#x53D1;&#x73B0;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; BCC &#x63D0;&#x4F9B;&#x7684;&#x5DE5;&#x5177; <code>execsnoop</code>&#x6765;&#x8FDB;&#x884C;&#x6392;&#x67E5;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash"><span class="token comment"># Trace file opens with process and filename: opensnoop</span>
<span class="token comment">#/usr/share/bcc/tools/execsnoop </span>
PCOMM            PID    <span class="token environment constant">PPID</span>   RET ARGS
<span class="token function">sleep</span>            <span class="token number">3334</span>   <span class="token number">21029</span>    <span class="token number">0</span> /usr/bin/sleep <span class="token number">3</span>
<span class="token function">sleep</span>            <span class="token number">3339</span>   <span class="token number">21029</span>    <span class="token number">0</span> /usr/bin/sleep <span class="token number">3</span>
conntrack        <span class="token number">3341</span>   <span class="token number">1112</span>     <span class="token number">0</span> /usr/sbin/conntrack --stats
conntrack        <span class="token number">3342</span>   <span class="token number">1112</span>     <span class="token number">0</span> /usr/sbin/conntrack --count
<span class="token function">sleep</span>            <span class="token number">3344</span>   <span class="token number">21029</span>    <span class="token number">0</span> /usr/bin/sleep <span class="token number">3</span>
iptables-save    <span class="token number">3347</span>   <span class="token number">9211</span>     <span class="token number">0</span> /sbin/iptables-save -t filter
iptables-save    <span class="token number">3348</span>   <span class="token number">9211</span>     <span class="token number">0</span> /sbin/iptables-save -t nat
</code></pre>
<h3 id="32-slab-dentry-&#x8FC7;&#x5927;&#x5BFC;&#x81F4;&#x7684;&#x7F51;&#x7EDC;&#x6296;&#x52A8;&#x6392;&#x67E5;"><a name="32-slab-dentry-&#x8FC7;&#x5927;&#x5BFC;&#x81F4;&#x7684;&#x7F51;&#x7EDC;&#x6296;&#x52A8;&#x6392;&#x67E5;" class="anchor-navigation-ex-anchor" href="#32-slab-dentry-&#x8FC7;&#x5927;&#x5BFC;&#x81F4;&#x7684;&#x7F51;&#x7EDC;&#x6296;&#x52A8;&#x6392;&#x67E5;"><i class="fa fa-link" aria-hidden="true"></i></a>3.2 slab dentry &#x8FC7;&#x5927;&#x5BFC;&#x81F4;&#x7684;&#x7F51;&#x7EDC;&#x6296;&#x52A8;&#x6392;&#x67E5;</h3>
<p><strong>&#x73B0;&#x8C61;</strong></p>
<p>&#x7F51;&#x7EDC; ping &#x7684;&#x5EF6;&#x65F6;&#x95F4;&#x6B47;&#x6027;&#x6709;&#x89C4;&#x5F8B;&#x51FA;&#x73B0;&#x6296;&#x52A8;</p>
<p><strong>&#x95EE;&#x9898;&#x6392;&#x67E5;</strong></p>
<p>&#x91C7;&#x7528; <code>execsnoop</code> &#x5206;&#x6790;&#x53D1;&#x73B0;&#xFF0C;&#x67D0;&#x4E2A;&#x8FD0;&#x884C;&#x547D;&#x4EE4;<code>cat /proc/slabinfo</code>&#x7684;&#x8FD0;&#x884C;&#x65F6;&#x95F4;&#x95F4;&#x9694;&#x4E0E;&#x6296;&#x52A8;&#x7684;&#x9891;&#x7387;&#x5B8C;&#x5168;&#x543B;&#x5408;&#xFF0C;&#x987A;&#x7740;&#x8FD9;&#x4E2A;&#x7684;&#x7EBF;&#x7D22;&#x5B9A;&#x4F4D;&#xFF0C;&#x6211;&#x4EEC;&#x53D1;&#x73B0;&#x4E91;&#x5382;&#x5546;&#x63D0;&#x4F9B;&#x7684; Java &#x7248;&#x672C;&#x7684;&#x4E91;&#x76D1;&#x63A7;&#x4F1A;&#x5B9A;&#x671F;&#x8C03;&#x7528; <code>cat /proc/slabinfo</code> &#x6765;&#x83B7;&#x53D6;&#x5185;&#x6838;&#x7F13;&#x5B58;&#x7684;&#x4FE1;&#x606F;&#xFF1B;</p>
<p>&#x901A;&#x8FC7;&#x547D;&#x4EE4; <code>slabtop</code> &#x53D1;&#x73B0;&#x7CFB;&#x7EDF;&#x4E2D;&#x7684; <code>dentry</code> &#x9879;&#x7684;&#x5185;&#x5B58;&#x5360;&#x7528;&#x975E;&#x5E38;&#x5927;&#xFF0C;&#x7CFB;&#x7EDF;&#x5185;&#x5B58; 128G&#xFF0C;<code>dentry</code> &#x5360;&#x7528; 70G &#x4EE5;&#x4E0A;&#xFF0C;&#x6240;&#x4EE5;&#x95EE;&#x9898;&#x5F88;&#x5FEB;&#x5C31;&#x5B9A;&#x4F4D;&#x5230;&#x662F;&#x7CFB;&#x7EDF;&#x5728;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x65B9;&#x9762;&#x53EF;&#x80FD;&#x6709;&#x76F8;&#x5173;&#x95EE;&#x9898;&#xFF1B;</p>
<p><strong>&#x6839;&#x56E0;&#x5206;&#x6790;</strong></p>
<p>&#x6211;&#x4EEC;&#x4F7F;&#x7528;&#x5BF9;&#x4E8E;&#x6253;&#x5F00;&#x6587;&#x4EF6;&#x8DDF;&#x8E2A;&#x7684; BCC &#x5DE5;&#x5177; <code>opensnoop</code> &#x5F88;&#x5FEB;&#x5C31;&#x5B9A;&#x4F4D;&#x5230;&#x662F;&#x67D0;&#x4E2A;&#x7A0B;&#x5E8F;&#x9891;&#x7E41;&#x521B;&#x5EFA;&#x548C;&#x5220;&#x9664;&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#xFF0C;&#x6700;&#x7EC8;&#x5B9A;&#x4F4D;&#x4E3A;&#x67D0;&#x4E2A; PHP &#x7A0B;&#x5E8F;&#x8BBE;&#x7F6E;&#x7684;&#x8C03;&#x7528;&#x65B9;&#x5F0F;&#x5B58;&#x5728;&#x95EE;&#x9898;&#xFF0C;&#x5BFC;&#x81F4;&#x6BCF;&#x6B21;&#x8BF7;&#x6C42;&#x4F1A;&#x521B;&#x5EFA;&#x548C;&#x5220;&#x9664;&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#xFF1B;&#x4EE3;&#x7801;&#x4E2D;&#x5C06; http &#x8C03;&#x7528;&#x4E2D;&#x7684; <code>contentType</code> &#x8BBE;&#x7F6E;&#x6210;&#x4E86; <code>Http::CONTENT_TYPE_UPLOAD</code>&#xFF0C;&#x5BFC;&#x81F4;&#x6BCF;&#x6B21;&#x8BF7;&#x6C42;&#x90FD;&#x4F1A;&#x751F;&#x6210;&#x4E34;&#x65F6;&#x6587;&#x4EF6;&#xFF0C;&#x4FEE;&#x6539;&#x6210; <code>application/x-www-form-urlencoded</code> &#x95EE;&#x9898;&#x89E3;&#x51B3;&#x3002;</p>
<p>&#x95EE;&#x9898;&#x7684;&#x539F;&#x7406;&#x53EF;&#x53C2;&#x8003; <a href="https://developer.aliyun.com/article/697773" target="_blank">&#x8BB0;&#x4E00;&#x6B21;&#x5BF9;&#x7F51;&#x7EDC;&#x6296;&#x52A8;&#x7ECF;&#x5178;&#x6848;&#x4F8B;&#x7684;&#x5206;&#x6790;</a> &#x548C; <a href="https://yq.aliyun.com/articles/131870" target="_blank">systemtap&#x811A;&#x672C;&#x5206;&#x6790;&#x7CFB;&#x7EDF;&#x4E2D;dentry SLAB&#x5360;&#x7528;&#x8FC7;&#x9AD8;&#x95EE;&#x9898;</a></p>
<h3 id="33-&#x751F;&#x6210;&#x706B;&#x7130;&#x56FE;"><a name="33-&#x751F;&#x6210;&#x706B;&#x7130;&#x56FE;" class="anchor-navigation-ex-anchor" href="#33-&#x751F;&#x6210;&#x706B;&#x7130;&#x56FE;"><i class="fa fa-link" aria-hidden="true"></i></a>3.3 &#x751F;&#x6210;&#x706B;&#x7130;&#x56FE;</h3>
<p>&#x706B;&#x7130;&#x56FE;&#x662F;&#x5E2E;&#x52A9;&#x6211;&#x4EEC;&#x5BF9;&#x7CFB;&#x7EDF;&#x8017;&#x65F6;&#x8FDB;&#x884C;&#x53EF;&#x89C6;&#x5316;&#x7684;&#x56FE;&#x8868;&#xFF0C;&#x80FD;&#x591F;&#x5BF9;&#x7A0B;&#x5E8F;&#x4E2D;&#x90A3;&#x4E9B;&#x4EE3;&#x7801;&#x7ECF;&#x5E38;&#x88AB;&#x6267;&#x884C;&#x7ED9;&#x51FA;&#x4E00;&#x4E2A;&#x6E05;&#x6670;&#x7684;&#x5C55;&#x73B0;&#x3002;Brendan Gregg &#x662F;&#x706B;&#x7130;&#x56FE;&#x7684;&#x521B;&#x5EFA;&#x8005;&#xFF0C;&#x4ED6;&#x5728; <a href="https://github.com/brendangregg/FlameGraph" target="_blank">GitHub</a> &#x4E0A;&#x7EF4;&#x62A4;&#x4E86;&#x4E00;&#x7EC4;&#x811A;&#x672C;&#x53EF;&#x4EE5;&#x8F7B;&#x677E;&#x751F;&#x6210;&#x9700;&#x8981;&#x7684;&#x53EF;&#x89C6;&#x5316;&#x683C;&#x5F0F;&#x6570;&#x636E;&#x3002;&#x4F7F;&#x7528; BCC &#x4E2D;&#x7684;&#x5DE5;&#x5177; <code>profile</code> &#x53EF;&#x5F88;&#x65B9;&#x9762;&#x5730;&#x6536;&#x96C6;&#x9053; CPU &#x8DEF;&#x5F84;&#x7684;&#x6570;&#x636E;&#xFF0C;&#x57FA;&#x4E8E;&#x6570;&#x636E;&#x91C7;&#x7528;&#x5DE5;&#x5177;&#x53EF;&#x4EE5;&#x8F7B;&#x677E;&#x5730;&#x751F;&#x6210;&#x706B;&#x7130;&#x56FE;&#xFF0C;&#x67E5;&#x627E;&#x5230;&#x7A0B;&#x5E8F;&#x7684;&#x6027;&#x80FD;&#x74F6;&#x9888;&#x3002;</p>
<blockquote>
<p>&#x4F7F;&#x7528; <code>profile</code> &#x641C;&#x96C6;&#x706B;&#x7130;&#x56FE;&#x7684;&#x7A0B;&#x5E8F;&#x6CA1;&#x6709;&#x4EFB;&#x4F55;&#x9650;&#x5236;&#x548C;&#x6539;&#x9020;</p>
</blockquote>
<p><code>profile</code> &#x5DE5;&#x5177;&#x53EF;&#x4EE5;&#x8BA9;&#x6211;&#x4EEC;&#x8F7B;&#x677E;&#x5BF9;&#x4E8E;&#x7CFB;&#x7EDF;&#x6216;&#x8005;&#x7A0B;&#x5E8F;&#x7684; CPU &#x6027;&#x80FD;&#x8DEF;&#x5F84;&#x8FDB;&#x884C;&#x53EF;&#x89C6;&#x5316;&#x5206;&#x6790;&#xFF1A;</p>
<pre class="language-"><code>/usr/share/bcc/tools/profile -h
usage: profile [-h] [-p PID | -L TID] [-U | -K] [-F FREQUENCY | -c COUNT] [-d]
               [-a] [-I] [-f] [--stack-storage-size STACK_STORAGE_SIZE]
               [-C CPU]
               [duration]

Profile CPU stack traces at a timed interval

positional arguments:
  duration              duration of trace, in seconds

optional arguments:
  -h, --help            show this help message and exit
  -p PID, --pid PID     profile process with this PID only
  -L TID, --tid TID     profile thread with this TID only
  -U, --user-stacks-only
                        show stacks from user space only (no kernel space
                        stacks)
  -K, --kernel-stacks-only
                        show stacks from kernel space only (no user space
                        stacks)
  -F FREQUENCY, --frequency FREQUENCY
                        sample frequency, Hertz
  -c COUNT, --count COUNT
                        sample period, number of events
  -d, --delimited       insert delimiter between kernel/user stacks
  -a, --annotations     add _[k] annotations to kernel frames
  -I, --include-idle    include CPU idle stacks
  -f, --folded          output folded format, one line per stack (for flame
                        graphs)
  --stack-storage-size STACK_STORAGE_SIZE
                        the number of unique stack traces that can be stored
                        and displayed (default 16384)
  -C CPU, --cpu CPU     cpu number to run profile on

examples:
    ./profile             # profile stack traces at 49 Hertz until Ctrl-C
    ./profile -F 99       # profile stack traces at 99 Hertz
    ./profile -c 1000000  # profile stack traces every 1 in a million events
    ./profile 5           # profile at 49 Hertz for 5 seconds only
    ./profile -f 5        # output in folded format for flame graphs
    ./profile -p 185      # only profile process with PID 185
    ./profile -L 185      # only profile thread with TID 185
    ./profile -U          # only show user space stacks (no kernel)
    ./profile -K          # only show kernel space stacks (no user)
</code></pre><p><code>profile</code> &#x914D;&#x5408; <code>FlameGraph</code> &#x53EF;&#x4EE5;&#x8F7B;&#x677E;&#x5E2E;&#x6211;&#x4EEC;&#x7ED8;&#x5236;&#x51FA; CPU &#x4F7F;&#x7528;&#x7684;&#x706B;&#x7130;&#x56FE;&#x3002;</p>
<pre class="language-"><code class="lang-bash">$ profile -af <span class="token number">30</span> <span class="token operator">&gt;</span> out.stacks01
$ <span class="token function">git</span> clone https://github.com/brendangregg/FlameGraph
$ <span class="token builtin class-name">cd</span> FlameGraph
$ ./flamegraph.pl --color<span class="token operator">=</span>java <span class="token operator">&lt;</span> <span class="token punctuation">..</span>/out.stacks01 <span class="token operator">&gt;</span> out.svg
</code></pre>
<p><img src="https://cloudnative.to/blog/bpf-intro/flame.png" alt="img"> &#x56FE; 3-2 &#x706B;&#x7130;&#x56FE;</p>
<h3 id="33-&#x6392;&#x67E5;&#x7F51;&#x7EDC;&#x8C03;&#x7528;&#x6765;&#x6E90;"><a name="33-&#x6392;&#x67E5;&#x7F51;&#x7EDC;&#x8C03;&#x7528;&#x6765;&#x6E90;" class="anchor-navigation-ex-anchor" href="#33-&#x6392;&#x67E5;&#x7F51;&#x7EDC;&#x8C03;&#x7528;&#x6765;&#x6E90;"><i class="fa fa-link" aria-hidden="true"></i></a>3.3 &#x6392;&#x67E5;&#x7F51;&#x7EDC;&#x8C03;&#x7528;&#x6765;&#x6E90;</h3>
<p>&#x5728;&#x751F;&#x4EA7;&#x573A;&#x666F;&#x4E0B;&#xFF0C;&#x4F1A;&#x6709;&#x4E9B;&#x7279;&#x5B9A;&#x573A;&#x666F;&#x9700;&#x8981;&#x6293;&#x53D6;&#x8FDE;&#x63A5;&#x5230;&#x5916;&#x7F51;&#x7279;&#x5B9A;&#x5730;&#x5740;&#x7684;&#x7A0B;&#x5E8F;&#xFF0C;&#x8FD9;&#x65F6;&#x5019;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x91C7;&#x7528; BCC &#x5DE5;&#x5177;&#x96C6;&#x4E2D;&#x7684; <code>tcplife</code> &#x6765;&#x5B9A;&#x4F4D;&#x3002;</p>
<pre class="language-"><code>/usr/share/bcc/tools/tcplife -h
usage: tcplife [-h] [-T] [-t] [-w] [-s] [-p PID] [-L LOCALPORT]
               [-D REMOTEPORT]

Trace the lifespan of TCP sessions and summarize

optional arguments:
  -h, --help            show this help message and exit
  -T, --time            include time column on output (HH:MM:SS)
  -t, --timestamp       include timestamp on output (seconds)
  -w, --wide            wide column output (fits IPv6 addresses)
  -s, --csv             comma separated values output
  -p PID, --pid PID     trace this PID only
  -L LOCALPORT, --localport LOCALPORT
                        comma-separated list of local ports to trace.
  -D REMOTEPORT, --remoteport REMOTEPORT
                        comma-separated list of remote ports to trace.

examples:
    ./tcplife           # trace all TCP connect()s
    ./tcplife -t        # include time column (HH:MM:SS)
    ./tcplife -w        # wider colums (fit IPv6)
    ./tcplife -stT      # csv output, with times &amp; timestamps
    ./tcplife -p 181    # only trace PID 181
    ./tcplife -L 80     # only trace local port 80
    ./tcplife -L 80,81  # only trace local ports 80 and 81
    ./tcplife -D 80     # only trace remote port 80
</code></pre><p>&#x901A;&#x8FC7;&#x5728;&#x673A;&#x5668;&#x4E0A;&#x4F7F;&#x7528; <code>tcplife</code> &#x6765;&#x83B7;&#x53D6;&#x7684;&#x7F51;&#x7EDC;&#x8FDE;&#x63A5;&#x4FE1;&#x606F;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x5305;&#x62EC;&#x4E86; PID&#x3001;COMM&#x3001;&#x672C;&#x5730; IP &#x5730;&#x5740;&#x3001;&#x672C;&#x5730;&#x7AEF;&#x53E3;&#x3001;&#x8FDC;&#x7A0B; IP &#x5730;&#x5740;&#x548C;&#x8FDC;&#x7A0B;&#x7AEF;&#x53E3;&#xFF0C;&#x901A;&#x8FC7;&#x8FD9;&#x4E9B;&#x4FE1;&#x606F;&#x975E;&#x5E38;&#x65B9;&#x4FBF;&#x6392;&#x67E5;&#x5230;&#x8FDE;&#x63A5;&#x5230;&#x7279;&#x5B9A; IP &#x5730;&#x5740;&#x7684;&#x7A0B;&#x5E8F;&#xFF0C;&#x5C24;&#x5176;&#x662F;&#x8FDE;&#x63A5;&#x7684;&#x8FC7;&#x7A0B;&#x975E;&#x5E38;&#x77ED;&#x6682;&#xFF0C;&#x901A;&#x8FC7; <code>netstat</code> &#x7B49;&#x5176;&#x4ED6;&#x5DE5;&#x5177;&#x4E0D;&#x5BB9;&#x6613;&#x6392;&#x67E5;&#x7684;&#x573A;&#x666F;&#x3002;</p>
<pre class="language-"><code class="lang-bash"><span class="token comment"># /usr/share/bcc/tools/tcplife</span>
PID   COMM             IP LADDR                      LPORT RADDR                  RPORT  TX_KB  RX_KB MS
<span class="token number">1776</span>  blackbox_export  <span class="token number">4</span>  <span class="token number">169.254</span>.20.10              <span class="token number">35830</span> <span class="token number">169.254</span>.20.10          <span class="token number">53</span>       <span class="token number">0</span>      <span class="token number">0</span> <span class="token number">0.36</span>
<span class="token number">27150</span> node-cache       <span class="token number">4</span>  <span class="token number">169.254</span>.20.10              <span class="token number">53</span>    <span class="token number">169.254</span>.20.10          <span class="token number">35830</span>    <span class="token number">0</span>      <span class="token number">0</span> <span class="token number">0.36</span>
<span class="token number">12511</span> coredns          <span class="token number">4</span>  <span class="token number">127.0</span>.0.1                  <span class="token number">58492</span> <span class="token number">127.0</span>.0.1              <span class="token number">8080</span>     <span class="token number">0</span>      <span class="token number">0</span> <span class="token number">0.32</span>
<span class="token punctuation">..</span>.
</code></pre>
<p>&#x5982;&#x679C;&#x6211;&#x4EEC;&#x60F3;&#x77E5;&#x9053;&#x66F4;&#x52A0;&#x8BE6;&#x7EC6;&#x7684; TCP &#x72B6;&#x6001;&#x60C5;&#x51B5;&#xFF0C;&#x90A3;&#x4E48; <code>tcptracer</code> &#x53EF;&#x5C55;&#x793A;&#x66F4;&#x52A0;&#x8BE6;&#x7EC6;&#x7684; TCP &#x72B6;&#x6001;&#xFF0C;&#x5176;&#x4E2D; C &#x4EE3;&#x8868; Connect X &#x8868;&#x793A;&#x5173;&#x95ED;&#xFF0C; A &#x4EE3;&#x8868; Accept&#x3002;</p>
<pre class="language-"><code class="lang-bash"><span class="token comment"># /usr/share/bcc/tools/tcptracer </span>
Tracing TCP established connections. Ctrl-C to end.
T  PID    COMM             IP SADDR            DADDR            SPORT  DPORT
C  <span class="token number">21066</span>  ilogtail         <span class="token number">4</span>  <span class="token number">10.81</span>.128.12     <span class="token number">100.100</span>.49.128   <span class="token number">40906</span>  <span class="token number">80</span>
X  <span class="token number">21066</span>  ilogtail         <span class="token number">4</span>  <span class="token number">10.81</span>.128.12     <span class="token number">100.100</span>.49.128   <span class="token number">40906</span>  <span class="token number">80</span>
C  <span class="token number">21066</span>  ilogtail         <span class="token number">4</span>  <span class="token number">10.81</span>.128.12     <span class="token number">100.100</span>.49.128   <span class="token number">40908</span>  <span class="token number">80</span>
X  <span class="token number">21066</span>  ilogtail         <span class="token number">4</span>  <span class="token number">10.81</span>.128.12     <span class="token number">100.100</span>.49.128   <span class="token number">40908</span>  <span class="token number">80</span>
</code></pre>
<p><code>tcpstates</code> &#x8FD8;&#x80FD;&#x591F;&#x5C55;&#x793A;&#x51FA;&#x6765; TCP &#x72B6;&#x6001;&#x673A;&#x7684;&#x6D41;&#x8F6C;&#x60C5;&#x51B5;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash"><span class="token comment"># /usr/share/bcc/tools/tcpstates</span>
SKADDR           C-PID C-COMM     LADDR           LPORT RADDR           RPORT OLDSTATE    -<span class="token operator">&gt;</span> NEWSTATE    MS
ffff9fd7e8192000 <span class="token number">22384</span> <span class="token function">curl</span>       <span class="token number">100.66</span>.100.185  <span class="token number">0</span>     <span class="token number">52.33</span>.159.26    <span class="token number">80</span>    CLOSE       -<span class="token operator">&gt;</span> SYN_SENT    <span class="token number">0.000</span>
ffff9fd7e8192000 <span class="token number">0</span>     swapper/5  <span class="token number">100.66</span>.100.185  <span class="token number">63446</span> <span class="token number">52.33</span>.159.26    <span class="token number">80</span>    SYN_SENT    -<span class="token operator">&gt;</span> ESTABLISHED <span class="token number">1.373</span>
ffff9fd7e8192000 <span class="token number">22384</span> <span class="token function">curl</span>       <span class="token number">100.66</span>.100.185  <span class="token number">63446</span> <span class="token number">52.33</span>.159.26    <span class="token number">80</span>    ESTABLISHED -<span class="token operator">&gt;</span> FIN_WAIT1   <span class="token number">176.042</span>
</code></pre>
<p>&#x540C;&#x6837;&#xFF0C;&#x6211;&#x4EEC;&#x4E5F;&#x53EF;&#x4EE5;&#x5B9E;&#x65F6;&#x83B7;&#x53D6;&#x5230; TCP &#x8FDE;&#x63A5;&#x8D85;&#x65F6;&#x6216;&#x8005;&#x91CD;&#x8FDE;&#x7684;&#x7F51;&#x7EDC;&#x8FDE;&#x63A5;&#xFF1B;&#x4E5F;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x6293;&#x53D6; UDP&#x5305;&#x76F8;&#x5173;&#x7684;&#x8FDE;&#x63A5;&#x4FE1;&#x606F;&#xFF0C;&#x7528;&#x4E8E;&#x5B9A;&#x4F4D;&#x8BF8;&#x5982; DNS &#x8BF7;&#x6C42;&#x8D85;&#x65F6;&#x6216;&#x8005; DNS &#x8BF7;&#x6C42;&#x7684;&#x53D1;&#x8D77;&#x8FDB;&#x7A0B;&#x3002;</p>
<h2 id="4-&#x7F16;&#x5199;-bpf-&#x7A0B;&#x5E8F;"><a name="4-&#x7F16;&#x5199;-bpf-&#x7A0B;&#x5E8F;" class="anchor-navigation-ex-anchor" href="#4-&#x7F16;&#x5199;-bpf-&#x7A0B;&#x5E8F;"><i class="fa fa-link" aria-hidden="true"></i></a>4. &#x7F16;&#x5199; BPF &#x7A0B;&#x5E8F;</h2>
<p>&#x5BF9;&#x4E8E;&#x5927;&#x591A;&#x6570;&#x5F00;&#x53D1;&#x8005;&#x800C;&#x8A00;&#xFF0C;&#x66F4;&#x591A;&#x7684;&#x662F;&#x57FA;&#x4E8E; BPF &#x6280;&#x672F;&#x4E4B;&#x4E0A;&#x7F16;&#x5199;&#x89E3;&#x51B3;&#x6211;&#x4EEC;&#x65E5;&#x5E38;&#x9047;&#x5230;&#x7684;&#x5404;&#x79CD;&#x95EE;&#x9898;&#xFF0C;&#x5F53;&#x524D; BCC &#x548C; BPFTrace &#x4E24;&#x4E2A;&#x9879;&#x76EE;&#x5728;&#x89C2;&#x6D4B;&#x548C;&#x6027;&#x80FD;&#x5206;&#x6790;&#x4E0A;&#x5DF2;&#x7ECF;&#x6709;&#x4E86;&#x8BF8;&#x591A;&#x7075;&#x6D3B;&#x4E14;&#x529F;&#x80FD;&#x5F3A;&#x5927;&#x7684;&#x5DE5;&#x5177;&#x7BB1;&#xFF0C;&#x5B8C;&#x5168;&#x53EF;&#x4EE5;&#x6EE1;&#x8DB3;&#x6211;&#x4EEC;&#x65E5;&#x5E38;&#x4F7F;&#x7528;&#x3002;</p>
<ul>
<li><a href="https://github.com/iovisor/bcc" target="_blank">BCC</a> &#x63D0;&#x4F9B;&#x4E86;&#x66F4;&#x9AD8;&#x9636;&#x7684;&#x62BD;&#x8C61;&#xFF0C;&#x53EF;&#x4EE5;&#x8BA9;&#x7528;&#x6237;&#x91C7;&#x7528; Python&#x3001;C++ &#x548C; Lua &#x7B49;&#x9AD8;&#x7EA7;&#x8BED;&#x8A00;&#x5FEB;&#x901F;&#x5F00;&#x53D1; BPF &#x7A0B;&#x5E8F;&#xFF1B;</li>
<li><a href="https://github.com/iovisor/bpftrace" target="_blank">BPFTrace</a> &#x91C7;&#x7528;&#x7C7B;&#x4F3C;&#x4E8E; awk &#x8BED;&#x8A00;&#x5FEB;&#x901F;&#x7F16;&#x5199; eBPF &#x7A0B;&#x5E8F;&#xFF1B;</li>
</ul>
<p>&#x66F4;&#x65E9;&#x671F;&#x7684;&#x5DE5;&#x5177;&#x5219;&#x662F;&#x4F7F;&#x7528; C &#x8BED;&#x8A00;&#x6765;&#x7F16;&#x5199; BPF &#x7A0B;&#x5E8F;&#xFF0C;&#x4F7F;&#x7528; LLVM clang &#x7F16;&#x8BD1;&#x6210; BPF &#x4EE3;&#x7801;&#xFF0C;&#x8FD9;&#x5BF9;&#x4E8E;&#x666E;&#x901A;&#x4F7F;&#x7528;&#x8005;&#x4E0A;&#x624B;&#x6709;&#x4E0D;&#x5C11;&#x95E8;&#x69DB;&#x5F53;&#x524D;&#x4EC5;&#x9650;&#x4E8E;&#x5BF9;&#x4E8E; eBPF &#x6280;&#x672F;&#x66F4;&#x52A0;&#x6DF1;&#x5165;&#x7684;&#x5B66;&#x4E60;&#x573A;&#x666F;&#x3002;</p>
<h3 id="41-bcc-&#x7248;&#x672C;-helloworld"><a name="41-bcc-&#x7248;&#x672C;-helloworld" class="anchor-navigation-ex-anchor" href="#41-bcc-&#x7248;&#x672C;-helloworld"><i class="fa fa-link" aria-hidden="true"></i></a>4.1 BCC &#x7248;&#x672C; HelloWorld</h3>
<p><img src="https://cloudnative.to/blog/bpf-intro/bcc-internals.png" alt="img" style="zoom: 67%;"></p>
<p>&#x56FE; 4-1 BCC &#x6574;&#x4F53;&#x67B6;&#x6784;</p>
<p>&#x4F7F;&#x7528; BCC &#x524D;&#x7AEF;&#x7ED1;&#x5B9A;&#x8BED;&#x8A00; Python &#x7F16;&#x5199;&#x7684; Hello World &#x7248;&#x672C;&#xFF1A;</p>
<pre class="language-"><code>#!/usr/bin/python3

from bcc import BPF

# This may not work for 4.17 on x64, you need replace kprobe__sys_clone with kprobe____x64_sys_clone
prog = &quot;&quot;&quot;
    int kprobe__sys_clone(void *ctx) {
        bpf_trace_printk(&quot;Hello, World!\\n&quot;);
        return 0;
    }
&quot;&quot;&quot;

b = BPF(text=prog, debug=0x04)
b.trace_print()
</code></pre><p>&#x8FD0;&#x884C;&#x7A0B;&#x5E8F;&#x524D;&#x9700;&#x8981;&#x5B89;&#x88C5;&#x8FC7; bcc &#x76F8;&#x5173;&#x5DE5;&#x5177;&#x5305;&#xFF0C;&#x5F53;&#x8FD0;&#x884C;&#x6B63;&#x5E38;&#x7684;&#x65F6;&#x5019;&#x6211;&#x4EEC;&#x53D1;&#x73B0;&#x6BCF;&#x5F53; <code>sys_clone</code> &#x7CFB;&#x7EDF;&#x8C03;&#x7528;&#x65F6;&#xFF0C;&#x8FD0;&#x884C;&#x7684;&#x63A7;&#x5236;&#x53F0;&#x4E0A;&#x5C31;&#x4F1A;&#x6253;&#x5370; &#x201C;Hello, World!&#x201D;&#xFF0C;&#x5728;&#x6253;&#x5370;&#x6587;&#x5B57;&#x524D;&#x9762;&#x8FD8;&#x5305;&#x542B;&#x4E86;&#x8C03;&#x7528;&#x7A0B;&#x5E8F;&#x7684;&#x8FDB;&#x7A0B;&#x540D;&#x79F0;&#xFF0C;&#x8FDB;&#x7A0B; ID &#x7B49;&#x4FE1;&#x606F;&#xFF1B;</p>
<blockquote>
<p>&#x5982;&#x679C;&#x8FD0;&#x884C;&#x62A5;&#x9519;&#xFF0C;&#x53EF;&#x80FD;&#x662F;&#x7F3A;&#x5C11;&#x5934;&#x6587;&#x4EF6;&#xFF0C;&#x4E00;&#x822C;&#x5B89;&#x88C5; kernel-devel &#x5305;&#x5373;&#x53EF;&#x3002;</p>
</blockquote>
<pre class="language-"><code># python ./hello.py
         kubelet-8349  [006] d... 33637334.829981: : Hello, World!
         kubelet-8349  [006] d... 33637334.838594: : Hello, World!
         kubelet-8349  [006] d... 33637334.843788: : Hello, World!
</code></pre><h3 id="43-bpftrace"><a name="43-bpftrace" class="anchor-navigation-ex-anchor" href="#43-bpftrace"><i class="fa fa-link" aria-hidden="true"></i></a>4.3 BPFTrace</h3>
<p>BPFTrace &#x662F;&#x57FA;&#x4E8E; BPF &#x548C; BCC &#x7684;&#x5F00;&#x6E90;&#x9879;&#x76EE;&#xFF0C;&#x4E0E; BCC &#x4E0D;&#x540C;&#x7684;&#x662F;&#x5176;&#x63D0;&#x4F9B;&#x4E86;&#x66F4;&#x9AD8;&#x5C42;&#x6B21;&#x7684;&#x62BD;&#x8C61;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x7C7B;&#x4F3C; AWK &#x811A;&#x672C;&#x8BED;&#x8A00;&#x6765;&#x7F16;&#x5199;&#x57FA;&#x4E8E; BPF &#x7684;&#x8DDF;&#x8E2A;&#x6216;&#x8005;&#x6027;&#x80FD;&#x6392;&#x67E5;&#x5DE5;&#x5177;&#xFF0C;&#x66F4;&#x52A0;&#x6613;&#x4E8E;&#x5165;&#x95E8;&#x548C;&#x7F16;&#x5199;&#xFF0C;&#x8BE5;&#x5DE5;&#x5177;&#x7684;&#x4E3B;&#x8981;&#x7075;&#x611F;&#x6765;&#x81EA;&#x4E8E; Solaris &#x7684; D &#x8BED;&#x8A00;&#x3002;BPFTrace &#x66F4;&#x65B9;&#x4FBF;&#x4E0E;&#x7F16;&#x5199;&#x5355;&#x884C;&#x7684;&#x7A0B;&#x5E8F;&#x3002;BPFTrace &#x4E0E; BCC &#x4E00;&#x6837;&#x4E5F;&#x662F; IO Visor &#x7EC4;&#x7EC7;&#x4E0B;&#x7684;&#x9879;&#x76EE;&#xFF0C;&#x4ED3;&#x5E93;&#x53C2;&#x89C1; <a href="https://github.com/iovisor/bpftrace" target="_blank">bpftrace</a>&#x3002;&#x66F4;&#x52A0;&#x6DF1;&#x5165;&#x7684;&#x5B66;&#x4E60;&#x8D44;&#x6599;&#x53C2;&#x89C1;&#xFF1A;<a href="https://github.com/iovisor/bpftrace/blob/master/docs/reference_guide.md" target="_blank">Reference Guide</a> &#x548C; <a href="https://github.com/iovisor/bpftrace/blob/master/docs/tutorial_one_liners.md" target="_blank">One-Liner Tutorial</a>&#x3002;</p>
<p>BPFTrace &#x4F7F;&#x7528; LLVM &#x5C06;&#x811A;&#x672C;&#x7F16;&#x8BD1;&#x6210; BPF &#x4E8C;&#x8FDB;&#x5236;&#x7801;&#xFF0C;&#x540E;&#x7EED;&#x4F7F;&#x7528; BCC &#x4E0E; Linux &#x5185;&#x6838;&#x8FDB;&#x884C;&#x4EA4;&#x4E92;&#x3002;&#x4ECE;&#x529F;&#x80FD;&#x5C42;&#x9762;&#x4E0A;&#x8BB2;&#xFF0C;BPFTrace &#x7684;&#x5B9A;&#x5236;&#x6027;&#x548C;&#x7075;&#x6D3B;&#x6027;&#x4E0D;&#x5982; BCC&#xFF0C;&#x4F46;&#x662F;&#x6BD4; BCC &#x5DE5;&#x5177;&#x66F4;&#x52A0;&#x6613;&#x4E8E;&#x7406;&#x89E3;&#x548C;&#x4F7F;&#x7528;&#xFF0C;&#x964D;&#x4F4E;&#x4E86; BPF &#x6280;&#x672F;&#x7684;&#x4F7F;&#x7528;&#x95E8;&#x69DB;&#x3002;</p>
<p>&#x4F7F;&#x7528;&#x6837;&#x4F8B;&#xFF1A;</p>
<pre class="language-"><code class="lang-bash"><span class="token comment"># &#x7EDF;&#x8BA1;&#x8FDB;&#x7A0B;&#x8C03;&#x7528; sys_enter &#x7684;&#x6B21;&#x6570;</span>
<span class="token comment">#bpftrace -e &apos;tracepoint:raw_syscalls:sys_enter { @[comm] = count(); }&apos;</span>
Attaching <span class="token number">1</span> probe<span class="token punctuation">..</span>.
^C

@<span class="token punctuation">[</span>bpftrace<span class="token punctuation">]</span>: <span class="token number">6</span>
@<span class="token punctuation">[</span>systemd<span class="token punctuation">]</span>: <span class="token number">24</span>
@<span class="token punctuation">[</span>snmp-pass<span class="token punctuation">]</span>: <span class="token number">96</span>
@<span class="token punctuation">[</span>sshd<span class="token punctuation">]</span>: <span class="token number">125</span>

<span class="token comment"># &#x7EDF;&#x8BA1;&#x5185;&#x6838;&#x4E2D;&#x51FD;&#x6570;&#x5806;&#x6808;&#x7684;&#x6B21;&#x6570;</span>
<span class="token comment"># bpftrace -e &apos;profile:hz:99 { @[kstack] = count(); }&apos;</span>
Attaching <span class="token number">1</span> probe<span class="token punctuation">..</span>.
^C

<span class="token punctuation">[</span><span class="token punctuation">..</span>.<span class="token punctuation">]</span>
@<span class="token punctuation">[</span>
filemap_map_pages+181
__handle_mm_fault+2905
handle_mm_fault+250
__do_page_fault+599
async_page_fault+69
<span class="token punctuation">]</span>: <span class="token number">12</span>
<span class="token punctuation">[</span><span class="token punctuation">..</span>.<span class="token punctuation">]</span>
@<span class="token punctuation">[</span>
cpuidle_enter_state+164
do_idle+390
cpu_startup_entry+111
start_secondary+423
secondary_startup_64+165
<span class="token punctuation">]</span>: <span class="token number">22122</span>
</code></pre>
<h3 id="43-c-&#x8BED;&#x8A00;&#x539F;&#x751F;&#x65B9;&#x5F0F;"><a name="43-c-&#x8BED;&#x8A00;&#x539F;&#x751F;&#x65B9;&#x5F0F;" class="anchor-navigation-ex-anchor" href="#43-c-&#x8BED;&#x8A00;&#x539F;&#x751F;&#x65B9;&#x5F0F;"><i class="fa fa-link" aria-hidden="true"></i></a>4.3 C &#x8BED;&#x8A00;&#x539F;&#x751F;&#x65B9;&#x5F0F;</h3>
<p>&#x91C7;&#x7528; LLVM Clang &#x7684;&#x65B9;&#x5F0F;&#x7F16;&#x8BD1;&#x4F1A;&#x6D89;&#x53CA;&#x5230;&#x5185;&#x6838;&#x7F16;&#x8BD1;&#x73AF;&#x5883;&#x642D;&#x5EFA;&#xFF0C;&#x800C;&#x4E14;&#x8FD8;&#x9700;&#x8981;&#x81EA;&#x5DF1;&#x7F16;&#x8BD1; Makefile &#x7B49;&#x64CD;&#x4F5C;&#xFF0C;&#x5C5E;&#x4E8E;&#x9AD8;&#x7EA7;&#x7528;&#x6237;&#x4F7F;&#x7528;&#xFF1A;</p>
<p>bpf_program.c</p>
<pre class="language-"><code class="lang-c"><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">&lt;linux/bpf.h&gt;</span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">define</span> <span class="token macro-name function">SEC</span><span class="token expression"><span class="token punctuation">(</span>NAME<span class="token punctuation">)</span> <span class="token keyword">__attribute__</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token function">section</span><span class="token punctuation">(</span>NAME<span class="token punctuation">)</span><span class="token punctuation">,</span> used<span class="token punctuation">)</span><span class="token punctuation">)</span></span></span>

<span class="token keyword">static</span> <span class="token keyword">int</span> <span class="token punctuation">(</span><span class="token operator">*</span>bpf_trace_printk<span class="token punctuation">)</span><span class="token punctuation">(</span><span class="token keyword">const</span> <span class="token keyword">char</span> <span class="token operator">*</span>fmt<span class="token punctuation">,</span> <span class="token keyword">int</span> fmt_size<span class="token punctuation">,</span>
                               <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token keyword">void</span> <span class="token operator">*</span><span class="token punctuation">)</span>BPF_FUNC_trace_printk<span class="token punctuation">;</span>

<span class="token function">SEC</span><span class="token punctuation">(</span><span class="token string">&quot;tracepoint/syscalls/sys_enter_execve&quot;</span><span class="token punctuation">)</span>
<span class="token keyword">int</span> <span class="token function">bpf_prog</span><span class="token punctuation">(</span><span class="token keyword">void</span> <span class="token operator">*</span>ctx<span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">char</span> msg<span class="token punctuation">[</span><span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token string">&quot;Hello, BPF World!&quot;</span><span class="token punctuation">;</span>
  <span class="token function">bpf_trace_printk</span><span class="token punctuation">(</span>msg<span class="token punctuation">,</span> <span class="token keyword">sizeof</span><span class="token punctuation">(</span>msg<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  <span class="token keyword">return</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token keyword">char</span> _license<span class="token punctuation">[</span><span class="token punctuation">]</span> <span class="token function">SEC</span><span class="token punctuation">(</span><span class="token string">&quot;license&quot;</span><span class="token punctuation">)</span> <span class="token operator">=</span> <span class="token string">&quot;GPL&quot;</span><span class="token punctuation">;</span>
</code></pre>
<p>loader.c</p>
<pre class="language-"><code class="lang-c"><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">&quot;bpf_load.h&quot;</span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">&lt;stdio.h&gt;</span></span>

<span class="token keyword">int</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token keyword">int</span> argc<span class="token punctuation">,</span> <span class="token keyword">char</span> <span class="token operator">*</span><span class="token operator">*</span>argv<span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token function">load_bpf_file</span><span class="token punctuation">(</span><span class="token string">&quot;bpf_program.o&quot;</span><span class="token punctuation">)</span> <span class="token operator">!=</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">&quot;The kernel didn&apos;t load the BPF program\n&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">return</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">;</span>
  <span class="token punctuation">}</span>

  <span class="token function">read_trace_pipe</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

  <span class="token keyword">return</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
<p>Makefile &#x6587;&#x4EF6;&#xFF08;&#x90E8;&#x5206;&#xFF09;</p>
<pre class="language-"><code class="lang-bash">build: <span class="token variable">${BPFCODE.c}</span> <span class="token variable">${BPFLOADER}</span>
    <span class="token variable"><span class="token variable">$(</span>CLANG<span class="token variable">)</span></span> -O2 -target bpf -c <span class="token variable"><span class="token variable">$(</span>BPFCODE:<span class="token operator">=</span>.c<span class="token variable">)</span></span> <span class="token variable"><span class="token variable">$(</span>CCINCLUDE<span class="token variable">)</span></span> -o <span class="token variable">${BPFCODE<span class="token operator">:=</span>.o}</span>
</code></pre>
<p>&#x5176;&#x4E2D; clang &#x7F16;&#x8BD1;&#x4E2D;&#x7684;&#x9009;&#x578B; <code>-target bpf</code> &#x8868;&#x660E;&#x6211;&#x4EEC;&#x5C06;&#x4EE3;&#x7801;&#x7F16;&#x8BD1;&#x6210; bpf &#x7684;&#x5B57;&#x8282;&#x7801;&#x3002;</p>
<p>&#x5B8C;&#x6574;&#x7684;&#x7A0B;&#x5E8F;&#x53C2;&#x89C1;&#xFF1A;<a href="https://github.com/DavadDi/linux-observability-with-bpf/tree/master/code/chapter-2/hello_world" target="_blank">hello_world</a>&#xFF1B;&#x66F4;&#x591A;&#x7684;&#x6837;&#x4F8B;&#x4EE3;&#x7801;&#x53EF;&#x4EE5;&#x53C2;&#x89C1;&#x5BF9;&#x5E94;&#x5185;&#x6838;&#x4E2D; <code>kernel-src/samples/bpf/</code> &#x4E0B;&#x7684;&#x6837;&#x4F8B;&#x4EE3;&#x7801;&#x3002;</p>
<blockquote>
<p>&#x540E;&#x7EED;&#x4F1A;&#x6301;&#x7EED;&#x8FDB;&#x884C; BPF &#x76F8;&#x5173;&#x7684;&#x5185;&#x5BB9;&#x603B;&#x7ED3;&#x548C;&#x5206;&#x4EAB;&#xFF0C;Github <a href="https://github.com/DavadDi/bpf_study" target="_blank">bpf_study</a> &#x4ED3;&#x5E93;&#xFF0C;&#x6B22;&#x8FCE;&#x63D0;&#x4EA4; PR &#x548C; Star</p>
</blockquote>
<h2 id="5-&#x53C2;&#x8003;&#x8D44;&#x6599;"><a name="5-&#x53C2;&#x8003;&#x8D44;&#x6599;" class="anchor-navigation-ex-anchor" href="#5-&#x53C2;&#x8003;&#x8D44;&#x6599;"><i class="fa fa-link" aria-hidden="true"></i></a>5. &#x53C2;&#x8003;&#x8D44;&#x6599;</h2>
<ol>
<li><a href="https://www.tcpdump.org/papers/bpf-usenix93.pdf" target="_blank">The BSD Packet Filter: A New Architecture for User-level Packet Capture</a></li>
<li><a href="http://arthurchiao.art/blog/cilium-bpf-xdp-reference-guide-zh/" target="_blank">[&#x8BD1;] Cilium&#xFF1A;BPF &#x548C; XDP &#x53C2;&#x8003;&#x6307;&#x5357;&#xFF08;2019&#xFF09; </a><a href="https://docs.cilium.io/en/v1.8/bpf/" target="_blank">Cillum BPF and XDP Reference Guide</a></li>
<li><a href="https://blog.cloudflare.com/zh/cloudflare-architecture-and-how-bpf-eats-the-world-zh/" target="_blank">Cloudflare&#x67B6;&#x6784;&#x4EE5;&#x53CA;BPF&#x5982;&#x4F55;&#x5360;&#x636E;&#x4E16;&#x754C;</a></li>
<li><a href="https://www.luoow.com/dc_tw/106805603" target="_blank">&#x95DC;&#x65BC; BPF &#x548C; eBPF &#x7684;&#x7B46;&#x8A18;</a></li>
<li><a href="https://qmonnet.github.io/whirl-offload/2016/09/01/dive-into-bpf/" target="_blank">Dive into BPF: a list of reading material</a> <a href="https://blog.csdn.net/F8qG7f9YD02Pe/article/details/79815702" target="_blank">&#x4E2D;&#x6587;</a></li>
<li><a href="https://www.ibm.com/developerworks/cn/linux/l-lo-eBPF-history/index.html" target="_blank">eBPF &#x7B80;&#x53F2;</a></li>
<li><a href="https://www.youtube.com/watch?v=znBGt7oHJyQ" target="_blank">https://www.youtube.com/watch?v=znBGt7oHJyQ</a></li>
<li><a href="https://www.infradead.org/~mchehab/kernel_docs/bpf/index.html" target="_blank">BPF Documentation</a> <a href="https://www.kernel.org/doc/html/latest/bpf/bpf_devel_QA.html#q-how-do-i-indicate-which-tree-bpf-vs-bpf-next-my-patch-should-be-applied-to" target="_blank">HOWTO interact with BPF subsystem</a></li>
<li><a href="https://www.infradead.org/~mchehab/kernel_docs/bpf/index.html" target="_blank">Linux &#x5185;&#x6838; BPF &#x6587;&#x6863;</a></li>
<li><a href="http://www.brendangregg.com/ebpf.html" target="_blank">Linux Extended BPF (eBPF) Tracing Tools</a> Brendan Gregg</li>
<li><a href="https://mp.weixin.qq.com/s/3BQU9AYh1ScZ_1V17BJ4wg" target="_blank">&#x6027;&#x80FD;&#x63D0;&#x5347;40%: &#x817E;&#x8BAF; TKE &#x7528; eBPF&#x7ED5;&#x8FC7; conntrack &#x4F18;&#x5316;K8s Service</a></li>
<li><a href="https://tonydeng.github.io/sdn-handbook/" target="_blank">SDN handbook</a></li>
<li>Linux BPF &#x5E2E;&#x52A9;&#x6587;&#x6863; <a href="https://man7.org/linux/man-pages/man2/bpf.2.html" target="_blank">bpf(2)</a> <a href="https://man7.org/linux/man-pages/man7/bpf-helpers.7.html" target="_blank">bpf-helpers(7)</a> <a href="https://man7.org/linux/man-pages/man8/tc-bpf.8.html" target="_blank">tc-bpf(8)</a> </li>
</ol>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; caixisheng 2017 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2021-05-28 17:22:20
</span></footer> <link rel="stylesheet" type="text/css" href="https://storage.googleapis.com/app.klipse.tech/css/codemirror.css"> <script>     window.klipse_settings = {         selector: ".language-klipse, .lang-eval-clojure",         selector_eval_js: ".lang-eval-js",         selector_eval_python_client: ".lang-eval-python",         selector_eval_php: ".lang-eval-php",         selector_eval_scheme: ".lang-eval-scheme",         selector_eval_ruby: ".lang-eval-ruby",         selector_reagent: ".lang-reagent",        selector_google_charts: ".lang-google-chart",        selector_es2017: ".lang-eval-es2017",        selector_jsx: ".lang-eval-jsx",        selector_transpile_jsx: ".lang-transpile-jsx",        selector_render_jsx: ".lang-render-jsx",        selector_react: ".lang-react",        selector_eval_markdown: ".lang-render-markdown",        selector_eval_lambdaway: ".lang-render-lambdaway",        selector_eval_cpp: ".lang-eval-cpp",        selector_eval_html: ".lang-render-html",        selector_sql: ".lang-eval-sql",        selector_brainfuck: "lang-eval-brainfuck",        selector_js: ".lang-transpile-cljs"    }; </script> <script src="https://storage.googleapis.com/app.klipse.tech/plugin/js/klipse_plugin.js"></script>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="cilium.html" class="navigation navigation-prev " aria-label="Previous page: Cilium">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="readme.html" class="navigation navigation-next " aria-label="Next page: Readme">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Ebpf","level":"1.9.35.3","depth":3,"next":{"title":"Readme","level":"1.9.35.4","depth":3,"path":"blog/kubernetes/网络插件/readme.md","ref":"blog/kubernetes/网络插件/readme.md","articles":[]},"previous":{"title":"Cilium","level":"1.9.35.2","depth":3,"path":"blog/kubernetes/网络插件/cilium.md","ref":"blog/kubernetes/网络插件/cilium.md","articles":[]},"dir":"ltr"},"config":{"plugins":["summary","expandable-chapters","toggle-chapters","theme-comscore","-lunr","-search","-highlight","-livereload","search-plus@^0.0.11","simple-page-toc@^0.1.1","github@^2.0.0","github-buttons@2.1.0","edit-link@^2.0.2","disqus@^0.1.0","prism@^2.1.0","prism-themes@^0.0.2","advanced-emoji@^0.2.1","anchors@^0.7.1","include-codeblock@^3.0.2","emphasize@^1.1.0","katex@^1.1.3","splitter@^0.0.8","mermaid-gb3@2.1.0","tbfed-pagefooter@^0.0.1","expandable-chapters-small@^0.1.7","sectionx@^3.1.0","donate@^1.0.2","local-video@^1.0.1","anchor-navigation-ex@0.1.8","favicon@^0.0.2","3-ba@^0.9.0","terminal@^0.3.2","alerts@^0.2.0","include-csv@^0.1.0","puml@^1.0.1","musicxml@^1.0.2","klipse@^1.2.0","versions-select@^0.1.1","-sharing","sharing-plus@^0.0.2","graph@^0.1.0","chart@^0.2.0"],"root":".","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright © caixisheng 2017","modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"prism":{"css":["prism-themes/themes/prism-base16-ateliersulphurpool.light.css"]},"include-csv":{},"disqus":{"useIdentifier":false,"shortName":"gitbookuse"},"emphasize":{},"github":{"url":"https://github.com/xishengcai/xisheng.blog"},"puml":{},"simple-page-toc":{"maxDepth":3,"skipFirstH1":true},"summary":{},"splitter":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"versions-select":{"type":"branches"},"graph":{},"donate":{"alipay":"https://cai-hello-1253732611.cos.ap-shanghai.myqcloud.com/share/zhifubao-pay.jpg","alipayText":"支付宝打赏","button":"赏","title":"","wechat":"https://cai-hello-1253732611.cos.ap-shanghai.myqcloud.com/share/weixin-pay.jpg","wechatText":"微信打赏"},"katex":{},"fontsettings":{"theme":"white","family":"sans","size":2},"musicxml":{},"sectionx":{"tag":"b"},"mermaid-gb3":{},"anchor-navigation-ex":{"isRewritePageTitle":false,"tocLevel1Icon":"fa fa-hand-o-right","tocLevel2Icon":"fa fa-hand-o-right","tocLevel3Icon":"fa fa-hand-o-right"},"favicon":{"shortcut":"favicon.ico","bookmark":"favicon.ico"},"theme-comscore":{},"prism-themes":{},"alerts":{},"github-buttons":{"repo":"xishengcai/xisheng.blog","types":["star"],"size":"small"},"3-ba":{"configuration":"auto","token":"ff100361cdce95dd4c8fb96b4009f7bc"},"expandable-chapters-small":{},"local-video":{},"klipse":{"myConfigKey":"it's the default value"},"advanced-emoji":{"embedEmojis":false},"include-codeblock":{"check":false,"edit":true,"fixlang":false,"lang":"","template":"ace","theme":"chrome","unindent":true},"sharing":{"qq":false,"all":["facebook","google","twitter","weibo","instapaper","linkedin","pocket","stumbleupon","qq","qzone"],"douban":false,"facebook":false,"weibo":true,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"google":true,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":true},"terminal":{"copyButtons":true,"fade":false,"style":"flat"},"edit-link":{"label":"Edit This Page","base":"https://github.com/xishengcai/xisheng.blog/edit/master"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":true},"anchors":{},"chart":{"type":"c3"},"toggle-chapters":{},"expandable-chapters":{},"search-plus":{}},"theme":"default","author":"xishengcai","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"这是程序员吗","language":"zh-hans","output.name":"site","links":{"sidebar":{"Home":"https://xisheng.vip"}},"gitbook":"3.2.3","description":"这是程序员吗"},"file":{"path":"blog/kubernetes/网络插件/ebpf.md","mtime":"2021-05-28T09:22:20.122Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-06-23T07:51:54.455Z"},"basePath":"../../..","book":{"language":""}});
        });
    </script>
</div>

        
    
    <script src="../../../gitbook/gitbook.js"></script>
    <script src="../../../gitbook/theme.js"></script>
    
        
        <script src="../../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-toggle-chapters/toggle.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-edit-link/plugin.js"></script>
        
    
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/URI.js/1.16.1/URI.min.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-disqus/plugin.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-sectionx/sectionx.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-local-video/video.min.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-3-ba/plugin.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-terminal/plugin.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-alerts/plugin.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-musicxml/osmd.min.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-musicxml/musicxml.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-musicxml/promise.min.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-versions-select/plugin.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    <script src="../../../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>

    </body>
</html>

